26 size_t i, j, seed = 1;
27 static const char vowels[] = {
28 'a',
'e',
'i',
'o',
'u',
'y'
30 static const char consonants[] = {
31 'b',
'c',
'd',
'f',
'g',
'h',
'k',
'l',
'm',
'n',
32 'p',
'r',
's',
't',
'v',
'z',
'x'
39 if ((
LONG_MAX - 2) / 3 < (digest_len | 1)) {
50 unsigned char byte1, byte2;
52 if (i >= digest_len) {
53 p[j++] = vowels[seed % 6];
54 p[j++] = consonants[16];
55 p[j++] = vowels[seed / 6];
60 p[j++] = vowels[(((byte1 >> 6) & 3) + seed) % 6];
61 p[j++] = consonants[(byte1 >> 2) & 15];
62 p[j++] = vowels[((byte1 & 3) + (seed / 6)) % 6];
64 if (i >= digest_len) {
69 p[j++] = consonants[(byte2 >> 4) & 15];
71 p[j++] = consonants[byte2 & 15];
73 seed = (seed * 5 + byte1 * 7 + byte2) % 36;
124 VALUE mDigest, mDigest_Instance, cDigest_Class;
#define RSTRING_LEN(string)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
void Init_bubblebabble(void)
static VALUE rb_digest_s_bubblebabble(VALUE klass, VALUE str)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
#define RSTRING_PTR(string)
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_path2class(const char *)
static VALUE bubblebabble_str_new(VALUE str_digest)
VALUE rb_require(const char *)
static VALUE rb_digest_class_s_bubblebabble(int argc, VALUE *argv, VALUE klass)
static VALUE rb_digest_instance_bubblebabble(VALUE self)
void rb_define_module_function(VALUE module, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a module function for module.
VALUE rb_funcall2(VALUE, ID, int, const VALUE *)
Calls a method.
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE rb_str_new(const char *, long)