public
Created

Binding the libc 'crypt' function using FFI.

  • Download Gist
ffi_crypt.rb
Ruby
1 2 3 4 5 6 7 8 9 10
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'

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.