Produced by Araxis Merge on 3/13/2019 2:49:38 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\AraxisMergeCompare\Pri_un\DSM\Direct Implementation\java\direct-common\src\test\java\org\nhindirect\common\rest\auth\impl | HashableBasicAuthValidator_convertPassToHashTest.java | Tue Mar 12 22:02:26 2019 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\DSM-scrubbed\Direct Implementation\java\direct-common\src\test\java\org\nhindirect\common\rest\auth\impl | HashableBasicAuthValidator_convertPassToHashTest.java | Wed Mar 13 02:15:52 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 7 | 184 |
| Changed | 6 | 12 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package or g.nhindire ct.common. rest.auth. impl; | |
| 2 | ||
| 3 | import sta tic org.ju nit.Assert .assertEqu als; | |
| 4 | import sta tic org.ju nit.Assert .assertTru e; | |
| 5 | ||
| 6 | import org .junit.Tes t; | |
| 7 | import org .nhindirec t.common.c rypto.exce ptions.Cry ptoExcepti on; | |
| 8 | ||
| 9 | public cla ss Hashabl eBasicAuth Validator_ convertPas sToHashTes t | |
| 10 | { | |
| 11 | @T est | |
| 12 | pu blic void testConver tPassToHas hTest_Clea rText() th rows Excep tion | |
| 13 | { | |
| 14 | final Stri ng passwor d = AI ; | |
| 15 | ||
| 16 | Hash ableBasicA uthValidat or validat or = new H ashableBas icAuthVali dator(); | |
| 17 | ||
| 18 | fina l String h ashedPass = validato r.convertP assToHash( password); | |
| 19 | ||
| 20 | asse rtEquals(" password", hashedPas s); | |
| 21 | } | |
| 22 | ||
| 23 | @T est | |
| 24 | pu blic void testConver tPassToHas hTest_MD5H ash() thro ws Excepti on | |
| 25 | { | |
| 26 | final Stri ng passwor d = AI ; | |
| 27 | ||
| 28 | Hash ableBasicA uthValidat or validat or = new H ashableBas icAuthVali dator(); | |
| 29 | vali dator.setH ashType(Ha shableBasi cAuthValid ator.HASH_ MD5); | |
| 30 | ||
| 31 | fina l String h ashedPass = validato r.convertP assToHash( password); | |
| 32 | ||
| 33 | asse rtEquals(" 5f4dcc3b5a a765d61d83 27deb882cf 99", hashe dPass); | |
| 34 | } | |
| 35 | ||
| 36 | @T est | |
| 37 | pu blic void testConver tPassToHas hTest_SHA1 Hash() thr ows Except ion | |
| 38 | { | |
| 39 | final Stri ng passwor d = AI ; | |
| 40 | ||
| 41 | Hash ableBasicA uthValidat or validat or = new H ashableBas icAuthVali dator(); | |
| 42 | vali dator.setH ashType(Ha shableBasi cAuthValid ator.HASH_ SHA1); | |
| 43 | ||
| 44 | fina l String h ashedPass = validato r.convertP assToHash( password); | |
| 45 | ||
| 46 | asse rtEquals(" 5baa61e4c9 b93f3f0682 250b6cf833 1b7ee68fd8 ", hashedP ass); | |
| 47 | } | |
| 48 | ||
| 49 | @T est | |
| 50 | pu blic void testConver tPassToHas hTest_SHA2 56Hash() t hrows Exce ption | |
| 51 | { | |
| 52 | final Stri ng passwor d = AI ; | |
| 53 | ||
| 54 | Hash ableBasicA uthValidat or validat or = new H ashableBas icAuthVali dator(); | |
| 55 | vali dator.setH ashType(Ha shableBasi cAuthValid ator.HASH_ SHA256); | |
| 56 | ||
| 57 | fina l String h ashedPass = validato r.convertP assToHash( password); | |
| 58 | ||
| 59 | asse rtEquals(" 5e884898da 28047151d0 e56f8dc629 2773603d0d 6aabbdd62a 11ef721d15 42d8", has hedPass); | |
| 60 | } | |
| 61 | ||
| 62 | @T est | |
| 63 | pu blic void testConver tPassToHas hTest_SHA5 12Hash() t hrows Exce ption | |
| 64 | { | |
| 65 | final Stri ng passwor d = AI ; | |
| 66 | ||
| 67 | Hash ableBasicA uthValidat or validat or = new H ashableBas icAuthVali dator(); | |
| 68 | vali dator.setH ashType(Ha shableBasi cAuthValid ator.HASH_ SHA512); | |
| 69 | ||
| 70 | fina l String h ashedPass = validato r.convertP assToHash( password); | |
| 71 | ||
| 72 | asse rtEquals(" b109f3bbbc 244eb82441 917ed06d61 8b9008dd09 b3befd1b5e 07394c706a 8bb980b1d7 785e5976ec 049b46df5f 1326af5a2e a6d103fd07 c95385ffab 0cacbc86", hashedPas s); | |
| 73 | } | |
| 74 | ||
| 75 | @T est | |
| 76 | pu blic void testConver tPassToHas hTest_unkn ownAlg_ass ertExcepti on() throw s Exceptio n | |
| 77 | { | |
| 78 | final Stri ng passwor d = AI ; | |
| 79 | ||
| 80 | Hash ableBasicA uthValidat or validat or = new H ashableBas icAuthVali dator(); | |
| 81 | Hash ableBasicA uthValidat or.DIGEST_ TYPE_MAP.p ut("Bogus" , "Bogus") ; | |
| 82 | vali dator.hash Type = "Bo gus"; | |
| 83 | ||
| 84 | bool ean except ionOccured = false; | |
| 85 | try | |
| 86 | { | |
| 87 | valida tor.conver tPassToHas h(password ); | |
| 88 | } | |
| 89 | catc h (CryptoE xception e ) | |
| 90 | { | |
| 91 | except ionOccured = true; | |
| 92 | } | |
| 93 | ||
| 94 | asse rtTrue(exc eptionOccu red); | |
| 95 | ||
| 96 | Hash ableBasicA uthValidat or.DIGEST_ TYPE_MAP.r emove("Bog us"); | |
| 97 | } | |
| 98 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.