-
-
Save jsakamoto/5532539 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (args.Length == 2 && args[1] == "-f") | |
{ | |
sha1(File.ReadAllBytes(args[2])); | |
} | |
else if (args.Length == 1) | |
{ | |
sha1(Encoding.ASCII.GetBytes(args[1])); | |
} | |
else if (args.Length == 0) | |
{ | |
sha1(Encoding.ASCII.GetBytes(Console.ReadToEnd()); | |
} | |
else | |
{ | |
throw new Exception("error"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match args with | |
| [| _; "-f"; path |] -> sha1(File.ReadAllBytes(path)) | |
| [| _; arg |] -> sha1(Encoding.ASCII.GetBytes(arg)) | |
| [| _ |] -> sha1(Encoding.ASCII.GetBytes(Console.ReadToEnd()) | |
| _ -> failwith("error") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match args with | |
| [| _; "-f"; path |] -> path |> File.ReadAllBytes |> sha1 | |
| [| _; arg |] -> arg |> Encoding.ASCII.GetBytes |> sha1 | |
| [| _ |] -> Console.ReadToEnd() |> Encoding.ASCII.GetBytes |> sha1 | |
| _ -> failwith("error") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment