diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-24 18:49:33 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-24 18:49:33 +0700 |
commit | 065a220aa138e996d711ff382d2435625dab408e (patch) | |
tree | 65d76d1a61ab343060d896536bab439712a2f28e /crypto/src/math/ec/rfc7748/X25519Field.cs | |
parent | NUnit3TestAdapter 4.3.1 (diff) | |
download | BouncyCastle.NET-ed25519-065a220aa138e996d711ff382d2435625dab408e.tar.xz |
Ed25519: cofactored verification
- Perf. opts.: Pornin's basis reduction - factor out Scalar25519 class
Diffstat (limited to 'crypto/src/math/ec/rfc7748/X25519Field.cs')
-rw-r--r-- | crypto/src/math/ec/rfc7748/X25519Field.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/src/math/ec/rfc7748/X25519Field.cs b/crypto/src/math/ec/rfc7748/X25519Field.cs index 241710fe9..2504592aa 100644 --- a/crypto/src/math/ec/rfc7748/X25519Field.cs +++ b/crypto/src/math/ec/rfc7748/X25519Field.cs @@ -319,6 +319,13 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748 } #endif + public static void Decode(byte[] x, int[] z) + { + Decode128(x, 0, z, 0); + Decode128(x, 16, z, 5); + z[9] &= M24; + } + public static void Decode(byte[] x, int xOff, int[] z) { Decode128(x, xOff, z, 0); @@ -425,6 +432,12 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748 } #endif + public static void Encode(int[] x, byte[] z) + { + Encode128(x, 0, z, 0); + Encode128(x, 5, z, 16); + } + public static void Encode(int[] x, byte[] z, int zOff) { Encode128(x, 0, z, zOff); |