diff options
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/api/bun.zig | 8 | ||||
-rw-r--r-- | src/bun.js/bindings/bindings.zig | 6 |
2 files changed, 4 insertions, 10 deletions
diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig index 5e92a470d..1c991eece 100644 --- a/src/bun.js/api/bun.zig +++ b/src/bun.js/api/bun.zig @@ -1541,13 +1541,7 @@ pub const Crypto = struct { } pub fn byNameAndEngine(engine: *BoringSSL.ENGINE, name: []const u8) ?EVP { - - // none of the names are longer than 255 - var buf: [256]u8 = undefined; - const len = @min(name.len, buf.len - 1); - _ = strings.copyLowercase(name, &buf); - - if (Algorithm.map.get(buf[0..len])) |algorithm| { + if (Algorithm.map.getWithEql(name, strings.eqlCaseInsensitiveASCIIIgnoreLength)) |algorithm| { if (algorithm == .blake2b256) { return EVP.init(algorithm, BoringSSL.EVP_blake2b256(), engine); } diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index 54d54f644..ebe5f83ed 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -295,14 +295,14 @@ pub const ZigString = extern struct { } pub fn eqlComptime(this: ZigString, comptime other: []const u8) bool { - if (this.len != other.len) - return false; - if (this.is16Bit()) { return strings.eqlComptimeUTF16(this.utf16SliceAligned(), other); } if (comptime strings.isAllASCIISimple(other)) { + if (this.len != other.len) + return false; + return strings.eqlComptimeIgnoreLen(this.slice(), other); } |