Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
sslver (Arch Linux)
using System;
using System.Runtime.InteropServices;
namespace sslver
{
class Program
{
[DllImport("libcrypto", CallingConvention = CallingConvention.Cdecl)]
public extern static uint OpenSSL_version_num();
static void Main(string[] args)
{
var ver = OpenSSL_version_num();
var major = (ver & 0xf0000000) >> 28;
var minor = (ver & 0x0ff00000) >> 20;
var fix = (ver & 0x000ff000) >> 12;
var patchNum = (ver & 0x00000ff0) >> 4;
char? patch = patchNum == 0 ? (char?)null : (char)('a' + patchNum - 1);
Console.WriteLine($"libcrypto {major}.{minor}.{fix}{patch}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment