@@ 7,6 7,7 @@ use strings;
@test fn bcrypt() void = {
const pass = strings::toutf8("hare is cool");
const hash = generate(pass, DEFAULT_COST);
+ defer free(hash);
assert(compare(hash, pass)!);
const notpass = strings::toutf8("hare is lame");
assert(!compare(hash, notpass)!);
@@ 18,5 19,6 @@ use strings;
const expect = "$2a$10$XajjQvNhvvRt5GSeFk1xFeyqRrsxkhBkUiQeg0dt.wU1qD4aFDcga";
const hash = strings::fromutf8(bcrypt(pass, salt, 10)!)!;
+ defer free(hash);
assert(strings::hassuffix(expect, hash));
};