15 #include "../digest.h"
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;
rb_funcall2(argv[0], id_yield, argc-1, argv+1)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
rb_funcall(memo->yielder, id_lshift, 1, rb_assoc_new(memo->prev_value, memo->prev_elts))
void Init_bubblebabble(void)
VALUE rb_require(const char *)
static VALUE rb_digest_s_bubblebabble(VALUE klass, VALUE str)
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
void rb_raise(VALUE exc, const char *fmt,...)
static VALUE rb_cDigest_Class
VALUE rb_path2class(const char *)
static VALUE bubblebabble_str_new(VALUE str_digest)
static VALUE rb_digest_class_s_bubblebabble(int argc, VALUE *argv, VALUE klass)
static VALUE rb_mDigest_Instance
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_define_module_under(VALUE outer, const char *name)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_str_new(const char *, long)
VALUE rb_define_module(const char *name)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)