25 lines
378 B
Plaintext
25 lines
378 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
from pyDes import *
|
||
|
|
||
|
data = "content to be encrypted"
|
||
|
k = des("DESCRYPT", CBC, "\0\0\0\0\0\0\0\0", pad=None, padmode=PAD_PKCS5) // Noncompliant
|
||
|
d = k.encrypt(data)
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
import hashlib
|
||
|
|
||
|
m = hashlib.sha256() // Compliant
|
||
|
m.update(data)
|
||
|
|
||
|
d = m.hexdigest()
|
||
|
----
|
||
|
|
||
|
include::../see.adoc[]
|