aboutsummaryrefslogtreecommitdiff
path: root/lib/std/crypto/bcrypt.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-04-29 00:19:55 -0700
committerGitHub <noreply@github.com>2023-04-29 00:19:55 -0700
commitd65b42e07caa00dfe2f2fbf221c593ce57882784 (patch)
tree7926cbea1499e0affe930bf6d7455dc24adf014e /lib/std/crypto/bcrypt.zig
parentfd6200eda6d4fe19c34a59430a88a9ce38d6d7a4 (diff)
parentfa200ca0cad2705bad40eb723dedf4e3bf11f2ff (diff)
downloadzig-d65b42e07caa00dfe2f2fbf221c593ce57882784.tar.gz
zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.zip
Merge pull request #15481 from ziglang/use-mem-intrinsics
actually use the new memory intrinsics
Diffstat (limited to 'lib/std/crypto/bcrypt.zig')
-rw-r--r--lib/std/crypto/bcrypt.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/crypto/bcrypt.zig b/lib/std/crypto/bcrypt.zig
index 2191ab0d9e..dda5f5e377 100644
--- a/lib/std/crypto/bcrypt.zig
+++ b/lib/std/crypto/bcrypt.zig
@@ -416,8 +416,8 @@ pub fn bcrypt(
) [dk_length]u8 {
var state = State{};
var password_buf: [73]u8 = undefined;
- const trimmed_len = math.min(password.len, password_buf.len - 1);
- mem.copy(u8, password_buf[0..], password[0..trimmed_len]);
+ const trimmed_len = @min(password.len, password_buf.len - 1);
+ @memcpy(password_buf[0..trimmed_len], password[0..trimmed_len]);
password_buf[trimmed_len] = 0;
var passwordZ = password_buf[0 .. trimmed_len + 1];
state.expand(salt[0..], passwordZ);
@@ -626,7 +626,7 @@ const CryptFormatHasher = struct {
crypto.random.bytes(&salt);
const hash = crypt_format.strHashInternal(password, salt, params);
- mem.copy(u8, buf, &hash);
+ @memcpy(buf[0..hash.len], &hash);
return buf[0..pwhash_str_length];
}