Skip to content

WIP: sha256sum applet #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
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
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
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
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

}
}

}