Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/metal.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ const Base58 = @import("base58.zig").Base58;

pub const Metal = struct {
allocator: std.mem.Allocator,
prng: std.rand.DefaultPrng,
attempts: u64,
start_time: i64,

pub fn init(allocator: std.mem.Allocator) !Metal {
const seed = @as(u64, @truncate(@as(u128, @bitCast(std.time.nanoTimestamp()))));
return Metal{
.allocator = allocator,
.prng = std.rand.DefaultPrng.init(seed),
.attempts = 0,
.start_time = std.time.milliTimestamp(),
};
Expand All @@ -38,9 +35,7 @@ pub const Metal = struct {
while (i < 256) : (i += 1) {
// Generate random seed
var seed: [32]u8 = undefined;
for (0..32) |j| {
seed[j] = self.prng.random().int(u8);
}
try std.crypto.random.bytes(&seed);

// Generate keypair
const keypair = Ed25519.generateKeypair(&seed);
Expand Down