Created
August 22, 2017 13:38
-
-
Save hjc4869/022cc84982b9f699179d873694c33051 to your computer and use it in GitHub Desktop.
sslver (Arch Linux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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