Skip to content

Instantly share code, notes, and snippets.

@zihadmahiuddin
Created May 11, 2018 16:49
Show Gist options
  • Save zihadmahiuddin/682461d20cec28f795697655a0991f75 to your computer and use it in GitHub Desktop.
Save zihadmahiuddin/682461d20cec28f795697655a0991f75 to your computer and use it in GitHub Desktop.
public static void IncrementNonce(this byte[] nonce, int timesToIncrease = 2)
{
for (int j = 0; j < timesToIncrease; j++)
{
ushort c = 1;
for (ushort i = 0; i < nonce.Length; i++)
{
c += nonce[i];
nonce[i] = (byte)c;
c >>= 8;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment