~jason2605/dictu/trunk

« back to all changes in this revision

Viewing changes to tests/hashlib/sha256.du

  • Committer: GitHub
  • Author(s): Jason_000
  • Date: 2020-11-30 23:26:50 UTC
  • mfrom: (30.1.263)
  • Revision ID: git-v1:4923d4401e1b291604b053289ab9f435b10ee14d
Tags: v0.14.0
Merge pull request #340 from dictu-lang/develop

Release 0.14.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * sha256.du
 
3
 *
 
4
 * Testing the Hashlib.sha256() and Hashlib.verify() methods
 
5
 */
 
6
 
 
7
import Hashlib;
 
8
 
 
9
var hash = Hashlib.sha256("Dictu");
 
10
 
 
11
assert(type(hash) == "string");
 
12
assert(hash.len() == 64);
 
13
assert(hash == "889bb2f43047c331bed74b1a9b309cc66adff6c6d4c3517547813ad67ba8d105");
 
14
 
 
15
assert(Hashlib.verify(hash, Hashlib.sha256("Dictu")));
 
16
assert(Hashlib.verify(Hashlib.sha256("Dictu"), hash));
 
17
assert(Hashlib.verify(hash, "WRONG!") == false);
 
18
assert(Hashlib.verify(Hashlib.sha256("Dictu"), "WRONG!") == false);
 
19
assert(Hashlib.verify("WRONG", Hashlib.sha256("Dictu")) == false);
 
 
b'\\ No newline at end of file'