summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.ApplicationBlock/Util.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-26 19:36:32 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-26 19:36:32 -0700
commitca9c747ba9932cd9f506968bdd6845473bd1bf51 (patch)
tree8c789b64e7d4bb365a1c3b430a71bc78adcb97dd /samples/DotNetOpenAuth.ApplicationBlock/Util.cs
parent02a87dd6f2aa8d14df4d877e7a6c0b8fd75bc2cb (diff)
parent8e3d5bb5d6e9cdfe6aa05394af082d142fcc9a0c (diff)
downloadDotNetOpenAuth-ca9c747ba9932cd9f506968bdd6845473bd1bf51.zip
DotNetOpenAuth-ca9c747ba9932cd9f506968bdd6845473bd1bf51.tar.gz
DotNetOpenAuth-ca9c747ba9932cd9f506968bdd6845473bd1bf51.tar.bz2
Merge branch 'pairwise'
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock/Util.cs')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/Util.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/Util.cs b/samples/DotNetOpenAuth.ApplicationBlock/Util.cs
index ea7da97..8a188ac 100644
--- a/samples/DotNetOpenAuth.ApplicationBlock/Util.cs
+++ b/samples/DotNetOpenAuth.ApplicationBlock/Util.cs
@@ -5,6 +5,8 @@
using DotNetOpenAuth.Messaging;
internal static class Util {
+ internal static readonly Random NonCryptoRandomDataGenerator = new Random();
+
/// <summary>
/// Enumerates through the individual set bits in a flag enum.
/// </summary>
@@ -28,6 +30,17 @@
}
/// <summary>
+ /// Gets a buffer of random data (not cryptographically strong).
+ /// </summary>
+ /// <param name="length">The length of the sequence to generate.</param>
+ /// <returns>The generated values, which may contain zeros.</returns>
+ internal static byte[] GetNonCryptoRandomData(int length) {
+ byte[] buffer = new byte[length];
+ NonCryptoRandomDataGenerator.NextBytes(buffer);
+ return buffer;
+ }
+
+ /// <summary>
/// Copies the contents of one stream to another.
/// </summary>
/// <param name="copyFrom">The stream to copy from, at the position where copying should begin.</param>