Create a gist now

Instantly share code, notes, and snippets.

Binding the libc 'crypt' function using FFI.
require 'ffi'
module Crypt
extend FFI::Library
ffi_lib 'c'
attach_function :crypt, [:string, :string], :string
end
p Crypt.crypt 'this is a string', 'this is the salt'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment