diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-02-08 19:28:30 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-02-08 19:28:30 +0700 |
commit | fd641911bfeea6a33842529559b708db8b1cc41d (patch) | |
tree | dd3b65f43275396a8ce544a31aee7bd0a0aa3434 /crypto/src/pqc | |
parent | Add outlining, reorder methods (diff) | |
download | BouncyCastle.NET-ed25519-fd641911bfeea6a33842529559b708db8b1cc41d.tar.xz |
Replace _Partial methods with _High/_Low variants
Diffstat (limited to 'crypto/src/pqc')
-rw-r--r-- | crypto/src/pqc/crypto/sphincsplus/SPHINCSPlusEngine.cs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/src/pqc/crypto/sphincsplus/SPHINCSPlusEngine.cs b/crypto/src/pqc/crypto/sphincsplus/SPHINCSPlusEngine.cs index fed041046..236330ff7 100644 --- a/crypto/src/pqc/crypto/sphincsplus/SPHINCSPlusEngine.cs +++ b/crypto/src/pqc/crypto/sphincsplus/SPHINCSPlusEngine.cs @@ -281,10 +281,10 @@ namespace Org.BouncyCastle.Pqc.Crypto.SphincsPlus // tree index // currently, only indexes up to 64 bits are supported - ulong treeIndex = Pack.BE_To_UInt64_Partial(output, forsMsgBytes, (int)treeBytes) + ulong treeIndex = Pack.BE_To_UInt64_Low(output, forsMsgBytes, (int)treeBytes) & ulong.MaxValue >> (64 - (int)treeBits); - uint leafIndex = Pack.BE_To_UInt32_Partial(output, forsMsgBytes + (int)treeBytes, (int)leafBytes) + uint leafIndex = Pack.BE_To_UInt32_Low(output, forsMsgBytes + (int)treeBytes, (int)leafBytes) & uint.MaxValue >> (32 - (int)leafBits); return new IndexedDigest(treeIndex, leafIndex, Arrays.CopyOfRange(output, 0, forsMsgBytes)); @@ -492,10 +492,10 @@ namespace Org.BouncyCastle.Pqc.Crypto.SphincsPlus // tree index // currently, only indexes up to 64 bits are supported - ulong treeIndex = Pack.BE_To_UInt64_Partial(output, forsMsgBytes, (int)treeBytes) + ulong treeIndex = Pack.BE_To_UInt64_Low(output, forsMsgBytes, (int)treeBytes) & ulong.MaxValue >> (64 - (int)treeBits); - uint leafIndex = Pack.BE_To_UInt32_Partial(output, forsMsgBytes + (int)treeBytes, (int)leafBytes) + uint leafIndex = Pack.BE_To_UInt32_Low(output, forsMsgBytes + (int)treeBytes, (int)leafBytes) & uint.MaxValue >> (32 - (int)leafBits); return new IndexedDigest(treeIndex, leafIndex, Arrays.CopyOfRange(output, 0, forsMsgBytes)); @@ -681,10 +681,10 @@ namespace Org.BouncyCastle.Pqc.Crypto.SphincsPlus // tree index // currently, only indexes up to 64 bits are supported - ulong treeIndex = Pack.BE_To_UInt64_Partial(output, forsMsgBytes, (int)treeBytes) + ulong treeIndex = Pack.BE_To_UInt64_Low(output, forsMsgBytes, (int)treeBytes) & ulong.MaxValue >> (64 - (int)treeBits); - uint leafIndex = Pack.BE_To_UInt32_Partial(output, forsMsgBytes + (int)treeBytes, (int)leafBytes) + uint leafIndex = Pack.BE_To_UInt32_Low(output, forsMsgBytes + (int)treeBytes, (int)leafBytes) & uint.MaxValue >> (32 - (int)leafBits); return new IndexedDigest(treeIndex, leafIndex, Arrays.CopyOfRange(output, 0, forsMsgBytes)); @@ -839,10 +839,10 @@ namespace Org.BouncyCastle.Pqc.Crypto.SphincsPlus // tree index // currently, only indexes up to 64 bits are supported - ulong treeIndex = Pack.BE_To_UInt64_Partial(indices[..treeBytes]) + ulong treeIndex = Pack.BE_To_UInt64_Low(indices[..treeBytes]) & ulong.MaxValue >> (64 - treeBits); - uint leafIndex = Pack.BE_To_UInt32_Partial(indices[treeBytes..]) + uint leafIndex = Pack.BE_To_UInt32_Low(indices[treeBytes..]) & uint.MaxValue >> (32 - leafBits); return new IndexedDigest(treeIndex, leafIndex, output); |