Guest User

Untitled

a guest
Nov 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Hash["a","SHA"]
  2. Hash[ToCharacterCode["a"],"SHA"]
  3.  
  4. Hash[ ByteArray @ ToCharacterCode["a"], "SHA"]
  5.  
  6. string = "a";
  7. Hash[string, "SHA"]
  8.  
  9. Export["test.txt", string, "String"];
  10. FileHash["test.txt", "SHA"]
  11.  
  12. Export["test.dat", ToCharacterCode@string, "Binary"];
  13. FileHash["test.dat", "SHA"]
  14.  
  15. string = "[BlackBishop]";
  16. Hash[string, "SHA"]
  17.  
  18. regularBytesString = ToString[string, CharacterEncoding -> $CharacterEncoding];
  19. Hash[regularBytesString, "SHA"]
  20.  
  21. (*it does encoding behind the hood because 9821 > 255*)
  22. Export["test.txt", string, "String"];
  23. FileHash["test.txt", "SHA"]
  24.  
  25. (*since there are only regualr bytes it should be the same as "String"*)
  26. Export["test.txt2", regularBytesString, "Text"];
  27. FileHash["test.txt2", "SHA"]
  28.  
  29. (*storing string bytes*)
  30. Export["test.txt3", regularBytesString, "String"];
  31. FileHash["test.txt3", "SHA"]
  32.  
  33. Export["test.dat", ToCharacterCode@ regularBytesString, "Binary"];
  34. FileHash["test.dat", "SHA"]
Add Comment
Please, Sign In to add comment