#include #include #include Result luna_main(int argc, char** argv) { Vector files; os::ArgumentParser parser; parser.add_description("Calculate SHA256 hashes for a series of files."_sv); parser.add_system_program_info("sha256sum"_sv); parser.set_vector_argument(files, "files"_sv, "-"_sv); parser.parse(argc, argv); for (auto path : files) { auto file = TRY(os::File::open_input_file(path)); auto data = TRY(file->read_all()); SHA256 sha; TRY(sha.append(data.data(), data.size())); auto digest = TRY(sha.digest()); auto string = TRY(digest.to_string()); os::println("%s %s", string.chars(), path.chars()); } return 0; }