@@ -54,16 +54,16 @@ enum Insecure {
54
54
55
55
func testHashMethods( passwd : UnsafeRawBufferPointer , cert: String , encrypted_passwd : String , account_no : String , credit_card_no : String ) {
56
56
var hash = Crypto . Insecure. MD5. hash ( data: passwd) // BAD
57
- hash = Crypto . Insecure. MD5. hash ( data: cert) // BAD [NOT DETECTED]
57
+ hash = Crypto . Insecure. MD5. hash ( data: cert) // BAD
58
58
hash = Crypto . Insecure. MD5. hash ( data: encrypted_passwd) // GOOD (not sensitive)
59
- hash = Crypto . Insecure. MD5. hash ( data: account_no) // BAD [NOT DETECTED]
59
+ hash = Crypto . Insecure. MD5. hash ( data: account_no) // BAD
60
60
hash = Crypto . Insecure. MD5. hash ( data: credit_card_no) // BAD
61
61
hash = Crypto . Insecure. MD5. hash ( data: credit_card_no) // BAD
62
62
63
63
hash = Crypto . Insecure. SHA1. hash ( data: passwd) // BAD
64
- hash = Crypto . Insecure. SHA1. hash ( data: cert) // BAD [NOT DETECTED]
64
+ hash = Crypto . Insecure. SHA1. hash ( data: cert) // BAD
65
65
hash = Crypto . Insecure. SHA1. hash ( data: encrypted_passwd) // GOOD (not sensitive)
66
- hash = Crypto . Insecure. SHA1. hash ( data: account_no) // BAD [NOT DETECTED]
66
+ hash = Crypto . Insecure. SHA1. hash ( data: account_no) // BAD
67
67
hash = Crypto . Insecure. SHA1. hash ( data: credit_card_no) // BAD
68
68
69
69
hash = Crypto . SHA256. hash ( data: passwd) // BAD [NOT DETECTED] not a computationally expensive hash
@@ -88,18 +88,18 @@ func testHashMethods(passwd : UnsafeRawBufferPointer, cert: String, encrypted_pa
88
88
func testMD5UpdateWithData( passwd : String , cert: String , encrypted_passwd : String , account_no : String , credit_card_no : String ) {
89
89
var hash = Crypto . Insecure. MD5 ( )
90
90
hash. update ( data: passwd) // BAD
91
- hash. update ( data: cert) // BAD [NOT DETECTED]
91
+ hash. update ( data: cert) // BAD
92
92
hash. update ( data: encrypted_passwd) // GOOD (not sensitive)
93
- hash. update ( data: account_no) // BAD [NOT DETECTED]
93
+ hash. update ( data: account_no) // BAD
94
94
hash. update ( data: credit_card_no) // BAD
95
95
}
96
96
97
97
func testSHA1UpdateWithData( passwd : String , cert: String , encrypted_passwd : String , account_no : String , credit_card_no : String ) {
98
98
var hash = Crypto . Insecure. SHA1 ( )
99
99
hash. update ( data: passwd) // BAD
100
- hash. update ( data: cert) // BAD [NOT DETECTED]
100
+ hash. update ( data: cert) // BAD
101
101
hash. update ( data: encrypted_passwd) // GOOD (not sensitive)
102
- hash. update ( data: account_no) // BAD [NOT DETECTED]
102
+ hash. update ( data: account_no) // BAD
103
103
hash. update ( data: credit_card_no) // BAD
104
104
}
105
105
@@ -130,18 +130,18 @@ func testSHA512UpdateWithData(passwd : String, cert: String, encrypted_passwd :
130
130
func testMD5UpdateWithUnsafeRawBufferPointer( passwd : UnsafeRawBufferPointer , cert: UnsafeRawBufferPointer , encrypted_passwd : UnsafeRawBufferPointer , account_no : UnsafeRawBufferPointer , credit_card_no : UnsafeRawBufferPointer ) {
131
131
var hash = Crypto . Insecure. MD5 ( )
132
132
hash. update ( bufferPointer: passwd) // BAD
133
- hash. update ( bufferPointer: cert) // BAD [NOT DETECTED]
133
+ hash. update ( bufferPointer: cert) // BAD
134
134
hash. update ( bufferPointer: encrypted_passwd) // GOOD (not sensitive)
135
- hash. update ( bufferPointer: account_no) // BAD [NOT DETECTED]
135
+ hash. update ( bufferPointer: account_no) // BAD
136
136
hash. update ( bufferPointer: credit_card_no) // BAD
137
137
}
138
138
139
139
func testSHA1UpdateWithUnsafeRawBufferPointer( passwd : UnsafeRawBufferPointer , cert: UnsafeRawBufferPointer , encrypted_passwd : UnsafeRawBufferPointer , account_no : UnsafeRawBufferPointer , credit_card_no : UnsafeRawBufferPointer ) {
140
140
var hash = Crypto . Insecure. SHA1 ( )
141
141
hash. update ( bufferPointer: passwd) // BAD
142
- hash. update ( bufferPointer: cert) // BAD [NOT DETECTED]
142
+ hash. update ( bufferPointer: cert) // BAD
143
143
hash. update ( bufferPointer: encrypted_passwd) // GOOD (not sensitive)
144
- hash. update ( bufferPointer: account_no) // BAD [NOT DETECTED]
144
+ hash. update ( bufferPointer: account_no) // BAD
145
145
hash. update ( bufferPointer: credit_card_no) // BAD
146
146
}
147
147
0 commit comments