Created
February 10, 2009 00:58
-
-
Save takai/61131 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Index: bcrypt_ext.c | |
=================================================================== | |
--- bcrypt_ext.c (revision 41) | |
+++ bcrypt_ext.c (working copy) | |
@@ -10,13 +10,14 @@ | |
/* Given a logarithmic cost parameter, generates a salt for use with +bc_crypt+. | |
*/ | |
static VALUE bc_salt(VALUE self, VALUE cost, VALUE seed) { | |
- return rb_str_new2((char *)bcrypt_gensalt(NUM2INT(cost), (u_int8_t *)RSTRING(seed)->ptr)); | |
+ return rb_str_new2((char *)bcrypt_gensalt(NUM2INT(cost), (u_int8_t *)RSTRING_PTR(seed))); | |
+ | |
} | |
/* Given a secret and a salt, generates a salted hash (which you can then store safely). | |
*/ | |
static VALUE bc_crypt(VALUE self, VALUE key, VALUE salt) { | |
- return rb_str_new2((char *)bcrypt(RSTRING(key)->ptr, (char *)RSTRING(salt)->ptr)); | |
+ return rb_str_new2((char *)bcrypt(RSTRING_PTR(key), (char *)RSTRING_PTR(salt))); | |
} | |
/* Create the BCrypt and BCrypt::Internals modules, and populate them with methods. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment