Files
wehub-resource-sync e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:29:30 +08:00

35 lines
1.1 KiB
Plaintext

fn crypto_fixed_hex32(buffer: MutSpan<u8>, value: u32) -> Maybe<Span<u8>> {
if std.mem.len(buffer) < 8 {
return null
}
var place: u32 = 268435456_u32
var index: usize = 0
while index < 8 {
let digit: u8 = ((value / place) % 16_u32) as u8
if digit < 10_u8 {
buffer[index] = 48_u8 + digit
} else {
buffer[index] = 87_u8 + digit
}
place = place / 16_u32
index = index + 1
}
return buffer[..8]
}
fn crypto_hash_hex32(buffer: MutSpan<u8>, bytes: Span<u8>) -> Maybe<Span<u8>> {
return crypto_fixed_hex32(buffer, std.crypto.hash32(bytes))
}
fn crypto_hmac_hex32(buffer: MutSpan<u8>, key: Span<u8>, bytes: Span<u8>) -> Maybe<Span<u8>> {
return crypto_fixed_hex32(buffer, std.crypto.hmac32(key, bytes))
}
fn crypto_stable_id32(buffer: MutSpan<u8>, bytes: Span<u8>) -> Maybe<Span<u8>> {
return crypto_fixed_hex32(buffer, std.crypto.hash32(bytes))
}
fn crypto_random_id32(buffer: MutSpan<u8>) -> Maybe<Span<u8>> {
return crypto_fixed_hex32(buffer, std.crypto.secureRandomU32())
}