diff NaCl/randombytes.cs @ 20:c873e3dd73fe

Added NaCl cryptography code
author Ivo Smits <Ivo@UCIS.nl>
date Mon, 15 Apr 2013 00:43:48 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NaCl/randombytes.cs	Mon Apr 15 00:43:48 2013 +0200
@@ -0,0 +1,16 @@
+using System;
+using System.Security.Cryptography;
+
+namespace UCIS.NaCl {
+	public static class randombytes {
+		public static void generate(Byte[] x) {
+			RNGCryptoServiceProvider rnd = new RNGCryptoServiceProvider();
+			rnd.GetBytes(x);
+		}
+		public static Byte[] generate(int count) {
+			Byte[] bytes = new Byte[count];
+			generate(bytes);
+			return bytes;
+		}
+	}
+}
\ No newline at end of file