Created
September 19, 2013 16:17
-
-
Save headius/6625851 to your computer and use it in GitHub Desktop.
Binding the libc 'crypt' function using FFI.
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
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