Skip to content

Commit

Permalink
chore: zig 0.13.0-dev.73+db890dbae
Browse files Browse the repository at this point in the history
  • Loading branch information
giann committed May 7, 2024
1 parent 0d68fd2 commit 7a0186a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 <myscript.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.
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.
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 }));
}
Expand Down
17 changes: 11 additions & 6 deletions src/lib/buzz_crypto.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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..];
Expand Down
5 changes: 3 additions & 2 deletions src/lib/crypto.buzz
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export enum HashAlgorithm {
Sha256,
Sha384,
Sha512,
Sha512256,
Sha512_224,
Sha512_256,
Sha512T256,
Sha3224,
Sha3256,
Expand All @@ -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;
export extern fun hash(HashAlgorithm algo, str data) > str;

0 comments on commit 7a0186a

Please sign in to comment.