forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stdlibs): support crypto/ed25519.Verify (gnolang#1863)
Support crypto/ed25519 on GnoVM <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Signed-off-by: Norman Meier <norman@samourai.coop> Co-authored-by: Miguel Victoria Villaquiran <Villaquiranm@users.noreply.github.com> Co-authored-by: Norman Meier <norman@samourai.coop> Co-authored-by: n0izn0iz <n0izn0iz@users.noreply.github.com>
- Loading branch information
1 parent
6b8a0e0
commit 04e282f
Showing
5 changed files
with
72 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ed25519 | ||
|
||
// Verify returns true if the signature is valid for the message and public key. | ||
func Verify(publicKey []byte, message []byte, signature []byte) bool { | ||
return verify(publicKey, message, signature) | ||
} | ||
|
||
func verify(publicKey []byte, message []byte, signature []byte) bool // injected |
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,9 @@ | ||
package ed25519 | ||
|
||
import ( | ||
"crypto/ed25519" | ||
) | ||
|
||
func X_verify(publicKey []byte, message []byte, signature []byte) bool { | ||
return ed25519.Verify(publicKey, message, signature) | ||
} |
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,16 @@ | ||
package ed25519 | ||
|
||
import ( | ||
"crypto/ed25519" | ||
"encoding/hex" | ||
"std" | ||
"testing" | ||
) | ||
|
||
func TestVerify(t *testing.T) { | ||
publicKey, _ := hex.DecodeString("0D853FA898A07EB91F618BB3E8B738B0E45BE9B3053799A2C42F8204F5FA3505") | ||
signature, _ := hex.DecodeString("2B39638983858715AD2FA059665ADFE267936B8F20C4DA01E9650958E0CA65C0255C75164360F468087FE8385140E48EE3471E332472A50AEE599F9D0EADD106") | ||
if !ed25519.Verify(publicKey, []byte("hello gno.land"), signature) { | ||
t.Error("verify failed") | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.