annotate NaCl/randombytes.cs @ 54:ba4e2cb031e0

Added general purpose tar archive reader class
author Ivo Smits <Ivo@UCIS.nl>
date Wed, 02 Oct 2013 21:17:30 +0200
parents c873e3dd73fe
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
1 ???using System;
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
2 using System.Security.Cryptography;
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
3
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
4 namespace UCIS.NaCl {
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
5 public static class randombytes {
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
6 public static void generate(Byte[] x) {
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
7 RNGCryptoServiceProvider rnd = new RNGCryptoServiceProvider();
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
8 rnd.GetBytes(x);
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
9 }
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
10 public static Byte[] generate(int count) {
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
11 Byte[] bytes = new Byte[count];
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
12 generate(bytes);
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
13 return bytes;
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
14 }
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
15 }
c873e3dd73fe Added NaCl cryptography code
Ivo Smits <Ivo@UCIS.nl>
parents:
diff changeset
16 }