-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #852 from wavesplatform/node-543-update-scrypto
NODE-543 Dirty move to Scrypto 2.0
- Loading branch information
Showing
67 changed files
with
300 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.wavesplatform | ||
|
||
import scorex.account.PrivateKeyAccount | ||
import scorex.crypto.hash.{Blake2b256, Keccak256} | ||
import scorex.crypto.signatures._ | ||
|
||
package object crypto { | ||
val SignatureLength: Int = Curve25519.SignatureLength | ||
|
||
val DigestSize: Int = 32 | ||
|
||
def fastHash(m: Array[Byte]): Array[Byte] = Blake2b256.hash(m) | ||
|
||
def fastHash(s: String): Array[Byte] = fastHash(s.getBytes()) | ||
|
||
def secureHash(m: Array[Byte]): Array[Byte] = Keccak256.hash(Blake2b256.hash(m)) | ||
|
||
def secureHash(s: String): Array[Byte] = secureHash(s.getBytes()) | ||
|
||
def sign(account: PrivateKeyAccount, message: Array[Byte]): Array[Byte] = | ||
Curve25519.sign(PrivateKey(account.privateKey), message) | ||
|
||
def sign(privateKeyBytes: Array[Byte], message: Array[Byte]): Array[Byte] = | ||
Curve25519.sign(PrivateKey(privateKeyBytes), message) | ||
|
||
def verify(signature: Array[Byte], message: Array[Byte], publicKey: Array[Byte]): Boolean = | ||
Curve25519.verify(Signature(signature), message, PublicKey(publicKey)) | ||
|
||
def createKeyPair(seed: Array[Byte]): (Array[Byte], Array[Byte]) = Curve25519.createKeyPair(seed) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.