Diogenes #3

Merged
rjindael merged 3 commits from master into master 2020-05-05 18:06:56 -05:00
1 changed files with 15 additions and 1 deletions
Showing only changes of commit fcf958cfee - Show all commits

View File

@ -8,6 +8,7 @@
*/ */
using System; using System;
using System.Text;
using System.Security.Cryptography; using System.Security.Cryptography;
public class CryptoRandom : RandomNumberGenerator public class CryptoRandom : RandomNumberGenerator
@ -19,6 +20,19 @@ public class CryptoRandom : RandomNumberGenerator
r = RandomNumberGenerator.Create(); r = RandomNumberGenerator.Create();
} }
private static string DiogenesCrypt(string word)
{
string result = "";
byte[] bytes = Encoding.ASCII.GetBytes(word);
foreach (byte singular in bytes)
{
result += Convert.ToChar(0x55 ^ singular);
}
return result;
}
///<param name=”buffer”>An array of bytes to contain random numbers.</param> ///<param name=”buffer”>An array of bytes to contain random numbers.</param>
public override void GetBytes(byte[] buffer) public override void GetBytes(byte[] buffer)
{ {
@ -52,4 +66,4 @@ public class CryptoRandom : RandomNumberGenerator
{ {
return Next(0, maxValue); return Next(0, maxValue);
} }
} }