You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
737 B
29 lines
737 B
using System;
|
|
|
|
namespace Org.BouncyCastle.Math.Raw
|
|
{
|
|
internal abstract class Bits
|
|
{
|
|
internal static uint BitPermuteStep(uint x, uint m, int s)
|
|
{
|
|
uint t = (x ^ (x >> s)) & m;
|
|
return (t ^ (t << s)) ^ x;
|
|
}
|
|
|
|
internal static ulong BitPermuteStep(ulong x, ulong m, int s)
|
|
{
|
|
ulong t = (x ^ (x >> s)) & m;
|
|
return (t ^ (t << s)) ^ x;
|
|
}
|
|
|
|
internal static uint BitPermuteStepSimple(uint x, uint m, int s)
|
|
{
|
|
return ((x & m) << s) | ((x >> s) & m);
|
|
}
|
|
|
|
internal static ulong BitPermuteStepSimple(ulong x, ulong m, int s)
|
|
{
|
|
return ((x & m) << s) | ((x >> s) & m);
|
|
}
|
|
}
|
|
}
|
|
|