@@ -14,14 +14,7 @@ import {
1414 SHA224Hashes ,
1515 SHA384Hashes ,
1616 KeccakHashes ,
17- HmacMD5s ,
18- HmacSHA1s ,
19- HmacSHA224s ,
20- HmacSHA256s ,
21- HmacSHA384s ,
22- HmacSHA512s ,
2317} from './C.js' ;
24- import hmacString from '../JSHash/JSHmac.js' ;
2518
2619describe ( 'JSHash hasString Function' , ( ) => {
2720 test ( 'MD5' , async ( ) => {
@@ -92,64 +85,4 @@ describe('JSHash hasString Function', () => {
9285 hashString ( 'value' , 'badHashAlgo' ) ,
9386 ) . rejects . toEqual ( new Error ( 'badHashAlgo algorithm is not suported' ) ) ;
9487 } ) ;
95-
96- test ( 'HmacMD5' , async ( ) => {
97- const iterator = TestStrings . entries ( ) ;
98- for ( const [ index , value ] of iterator ) {
99- await expect (
100- hmacString ( value , 'SecretKey' , CONSTANTS . HmacAlgorithms . HmacMD5 ) ,
101- ) . resolves . toEqual ( HmacMD5s [ index ] ) ;
102- }
103- } ) ;
104-
105- test ( 'HmacSHA1' , async ( ) => {
106- const iterator = TestStrings . entries ( ) ;
107- for ( const [ index , value ] of iterator ) {
108- await expect (
109- hmacString ( value , 'SecretKey' , CONSTANTS . HmacAlgorithms . HmacSHA1 ) ,
110- ) . resolves . toEqual ( HmacSHA1s [ index ] ) ;
111- }
112- } ) ;
113-
114- test ( 'HmacSHA224' , async ( ) => {
115- const iterator = TestStrings . entries ( ) ;
116- for ( const [ index , value ] of iterator ) {
117- await expect (
118- hmacString ( value , 'SecretKey' , CONSTANTS . HmacAlgorithms . HmacSHA224 ) ,
119- ) . resolves . toEqual ( HmacSHA224s [ index ] ) ;
120- }
121- } ) ;
122-
123- test ( 'HmacSHA256' , async ( ) => {
124- const iterator = TestStrings . entries ( ) ;
125- for ( const [ index , value ] of iterator ) {
126- await expect (
127- hmacString ( value , 'SecretKey' , CONSTANTS . HmacAlgorithms . HmacSHA256 ) ,
128- ) . resolves . toEqual ( HmacSHA256s [ index ] ) ;
129- }
130- } ) ;
131-
132- test ( 'HmacSHA384' , async ( ) => {
133- const iterator = TestStrings . entries ( ) ;
134- for ( const [ index , value ] of iterator ) {
135- await expect (
136- hmacString ( value , 'SecretKey' , CONSTANTS . HmacAlgorithms . HmacSHA384 ) ,
137- ) . resolves . toEqual ( HmacSHA384s [ index ] ) ;
138- }
139- } ) ;
140-
141- test ( 'HmacSHA512' , async ( ) => {
142- const iterator = TestStrings . entries ( ) ;
143- for ( const [ index , value ] of iterator ) {
144- await expect (
145- hmacString ( value , 'SecretKey' , CONSTANTS . HmacAlgorithms . HmacSHA512 ) ,
146- ) . resolves . toEqual ( HmacSHA512s [ index ] ) ;
147- }
148- } ) ;
149-
150- test ( 'badHmac' , async ( ) => {
151- await expect (
152- hmacString ( 'value' , 'SecretKey' , 'badHmacAlgo' ) ,
153- ) . rejects . toEqual ( new Error ( 'badHmacAlgo algorithm is not suported' ) ) ;
154- } ) ;
15588} ) ;
0 commit comments