Skip to content

Instantly share code, notes, and snippets.

@headius
Created September 19, 2013 16:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/6625851 to your computer and use it in GitHub Desktop.
Save headius/6625851 to your computer and use it in GitHub Desktop.
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