Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Binding the libc 'crypt' function using FFI.
require 'ffi'
module Crypt
extend FFI::Library
ffi_lib 'c'
attach_function :crypt, [:string, :string], :string
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