Mercurial > hg > ucis.core
annotate 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 |
rev | line source |
---|---|
20 | 1 ???using System; |
2 using System.Security.Cryptography; | |
3 | |
4 namespace UCIS.NaCl { | |
5 public static class randombytes { | |
6 public static void generate(Byte[] x) { | |
7 RNGCryptoServiceProvider rnd = new RNGCryptoServiceProvider(); | |
8 rnd.GetBytes(x); | |
9 } | |
10 public static Byte[] generate(int count) { | |
11 Byte[] bytes = new Byte[count]; | |
12 generate(bytes); | |
13 return bytes; | |
14 } | |
15 } | |
16 } |