Skip to content

Commit b6ac7df

Browse files
committed
point to fixed remote of zig-poseidon
1 parent 44db392 commit b6ac7df

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

build.zig.zon

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
.paths = .{""},
66
.dependencies = .{
77
.poseidon = .{
8-
.url = "https://github.com/blockblaz/zig-poseidon/archive/refs/tags/v0.2.0.tar.gz",
9-
.hash = "zig_poseidon-0.2.0-CHeW2H-SAAC83l4JGZOODgmgfEFpBa_KokE9oO3ilcf1",
8+
.url = "https://github.com/blockblaz/zig-poseidon/archive/c2281f863a4c51c5f7e2957e266744e158ded6ca.tar.gz",
9+
.hash = "zig_poseidon-0.2.0-CHeW2LS9AAB5ltpBgNJTHcTczmyAJjp7i_dwubSACNOR",
1010
},
11-
1211
},
1312
}

src/poseidon_wrapper.zig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,29 @@ test "PoseidonHasher deterministic" {
120120

121121
try std.testing.expectEqualSlices(u8, &output1, &output2);
122122
}
123+
124+
test "PoseidonHasher different inputs produce different outputs" {
125+
// Verify different inputs produce different outputs
126+
const poseidon = @import("poseidon");
127+
const Hasher = PoseidonHasher(poseidon.Poseidon2KoalaBear16);
128+
129+
var hasher1 = Hasher.init(.{});
130+
var hasher2 = Hasher.init(.{});
131+
132+
const data1 = "first test data";
133+
const data2 = "second test data";
134+
135+
hasher1.update(data1);
136+
hasher2.update(data2);
137+
138+
var output1: [32]u8 = undefined;
139+
var output2: [32]u8 = undefined;
140+
hasher1.final(&output1);
141+
hasher2.final(&output2);
142+
143+
// Verify outputs are different
144+
const are_equal = std.mem.eql(u8, &output1, &output2);
145+
try std.testing.expect(!are_equal);
146+
}
147+
148+

0 commit comments

Comments
 (0)