From 7a0186a5cd2e7214e843c71d4b71f3f2f0c12c71 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 7 May 2024 18:40:50 +0200 Subject: [PATCH] chore: zig 0.13.0-dev.73+db890dbae --- README.md | 4 ++-- build.zig | 2 +- src/lib/buzz_crypto.zig | 17 +++++++++++------ src/lib/crypto.buzz | 5 +++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index aab8c058..17a67be2 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ A small/lightweight statically typed scripting language written in Zig ## How to build and install -_Latest zig version supported: 0.13.0-dev.46+3648d7df1_ +_Latest zig version supported: 0.13.0-dev.73+db890dbae_ ### Requirements - Since this is built with Zig, you should be able to build buzz on a wide variety of architectures even though this has only been tested on x86/M1. @@ -63,4 +63,4 @@ If you're usage if performance critical (game dev for example), you can build us Remember to modify PATH to include the `bin` directory where it is installed. For example, `export PATH=PATH:/home/xxx/.local/bin`. You can then run buzz with `buzz `. Or you can simply run `buzz` to start the REPL. -Additionally, install the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=giann.buzz) to get syntax highlighting. If you don't use VS Code but your editor supports [TextMate grammar files](https://github.com/buzz-language/code/blob/main/syntaxes/buzz.tmLanguage.json), you can use that. \ No newline at end of file +Additionally, install the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=giann.buzz) to get syntax highlighting. If you don't use VS Code but your editor supports [TextMate grammar files](https://github.com/buzz-language/code/blob/main/syntaxes/buzz.tmLanguage.json), you can use that. diff --git a/build.zig b/build.zig index 37dc0e52..813c7ad9 100644 --- a/build.zig +++ b/build.zig @@ -98,7 +98,7 @@ fn getBuzzPrefix(b: *Build) []const u8 { pub fn build(b: *Build) !void { // Check minimum zig version const current_zig = builtin.zig_version; - const min_zig = std.SemanticVersion.parse("0.13.0-dev.46+3648d7df1") catch return; + const min_zig = std.SemanticVersion.parse("0.13.0-dev.73+db890dbae") catch return; if (current_zig.order(min_zig).compare(.lt)) { @panic(b.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig })); } diff --git a/src/lib/buzz_crypto.zig b/src/lib/buzz_crypto.zig index 7eb3d961..628b5320 100644 --- a/src/lib/buzz_crypto.zig +++ b/src/lib/buzz_crypto.zig @@ -59,31 +59,36 @@ pub export fn hash(ctx: *api.NativeCtx) c_int { result_hash = h[0..]; }, 6 => { - var h: [std.crypto.hash.sha2.Sha512256.digest_length]u8 = undefined; - std.crypto.hash.sha2.Sha512256.hash(data[0..data_len], &h, .{}); + var h: [std.crypto.hash.sha2.Sha512_224.digest_length]u8 = undefined; + std.crypto.hash.sha2.Sha512_224.hash(data[0..data_len], &h, .{}); result_hash = h[0..]; }, 7 => { + var h: [std.crypto.hash.sha2.Sha512_256.digest_length]u8 = undefined; + std.crypto.hash.sha2.Sha512_256.hash(data[0..data_len], &h, .{}); + result_hash = h[0..]; + }, + 8 => { var h: [std.crypto.hash.sha2.Sha512T256.digest_length]u8 = undefined; std.crypto.hash.sha2.Sha512T256.hash(data[0..data_len], &h, .{}); result_hash = h[0..]; }, - 8 => { + 9 => { var h: [std.crypto.hash.sha3.Sha3_224.digest_length]u8 = undefined; std.crypto.hash.sha3.Sha3_224.hash(data[0..data_len], &h, .{}); result_hash = h[0..]; }, - 9 => { + 10 => { var h: [std.crypto.hash.sha3.Sha3_256.digest_length]u8 = undefined; std.crypto.hash.sha3.Sha3_256.hash(data[0..data_len], &h, .{}); result_hash = h[0..]; }, - 10 => { + 11 => { var h: [std.crypto.hash.sha3.Sha3_384.digest_length]u8 = undefined; std.crypto.hash.sha3.Sha3_384.hash(data[0..data_len], &h, .{}); result_hash = h[0..]; }, - 11 => { + 12 => { var h: [std.crypto.hash.sha3.Sha3_512.digest_length]u8 = undefined; std.crypto.hash.sha3.Sha3_512.hash(data[0..data_len], &h, .{}); result_hash = h[0..]; diff --git a/src/lib/crypto.buzz b/src/lib/crypto.buzz index 070c88b3..494f07c1 100644 --- a/src/lib/crypto.buzz +++ b/src/lib/crypto.buzz @@ -8,7 +8,8 @@ export enum HashAlgorithm { Sha256, Sha384, Sha512, - Sha512256, + Sha512_224, + Sha512_256, Sha512T256, Sha3224, Sha3256, @@ -20,4 +21,4 @@ export enum HashAlgorithm { || @param algo Hash algorithm to use || @param data Data to hash || @return Hash of data has hex string -export extern fun hash(HashAlgorithm algo, str data) > str; \ No newline at end of file +export extern fun hash(HashAlgorithm algo, str data) > str;