Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sha256 thread safe #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ public object Sha256 {
0x510e527f, -0x64fa9774, 0x1f83d9ab, 0x5be0cd19
)

// Working arrays
private val W = IntArray(64)
private val H = IntArray(8)
private val TEMP = IntArray(8)

/**
* Hashes the given message with SHA-256 and returns the digest.
*
* @param message The bytes to digest.
* @return The digest's bytes.
*/
public fun digest(message: ByteArray): ByteArray {
// Working arrays
val W = IntArray(64)
val H = IntArray(8)
val TEMP = IntArray(8)

// Let H = H0
H0.copy(0,
H, 0, H0.size)
Expand Down