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
30 changes: 30 additions & 0 deletions src/sha256sum.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const std = @import("std");
const stdout = &std.io.getStdOut().outStream().stream;

pub fn sha256(name: []const u8) !void {
// encoding function
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you should implement sha256 here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still waiting for this feature! Super excited!

return;
}

pub fn main() !void {
// out of memory panic
const args = std.process.argsAlloc(std.heap.page_allocator) catch |err| {
try stdout.print("Out of memory: {}\n", .{err});
return;
};
defer std.process.argsFree(std.heap.page_allocator, args);

// For now, do not handle case where arguments are from stdin
if (args.len < 2) {
try stdout.print("sha256sum: missing operands \n", .{});
return;
}

// return sha256sum of each argument given
for (args) |arg, i| {
if(i != 0){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting... I see what you are planning but I don't see any actual code here. Is this planned?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eamonlm would love to hear your response to @sambattalio's question

}
}

}