Skip to content

Commit f313498

Browse files
authored
tests: add tests for SHA256 (TheAlgorithms#1604)
1 parent 6aaa376 commit f313498

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Hashes/tests/SHA256.test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { describe, test } from 'vitest'
2+
import { SHA256 } from '../SHA256'
3+
4+
describe('Testing SHA256 function', () => {
5+
it.each([
6+
['', 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'],
7+
[
8+
'The quick brown fox jumps over the lazy dog',
9+
'd7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592'
10+
],
11+
[
12+
'The quick brown fox jumps over the lazy cog',
13+
'e4c4d8f3bf76b692de791a173e05321150f7a345b46484fe427f6acc7ecc81be'
14+
],
15+
[
16+
'This was added by vil02 on 01.02.2024. Have a nice day!',
17+
'476025d91db754ab6ac0c124367afd7c108d041b2f497006a214d5035769ed5d'
18+
],
19+
[
20+
'012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789',
21+
'14582b3f153941891dca966b036a5b1de65fa3b7a2540095a31614da1de0feaf'
22+
],
23+
['a', 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb']
24+
])('check with %j', (input, expected) => {
25+
expect(SHA256(input)).toBe(expected)
26+
})
27+
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy