source: branches/eraser6/pluginsRewrite/Eraser.DefaultPlugins/RNGCrypto.cs @ 2459

Revision 2459, 1.5 KB checked in by lowjoel, 3 years ago (diff)

Woops, we do need to declare override since we are going to be inherited from a PrngBase? class (which will be committed later)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
3 * Copyright 2008-2010 The Eraser Project
4 * Original Author: Joel Low <lowjoel@users.sourceforge.net>
5 * Modified By:
6 *
7 * This file is part of Eraser.
8 *
9 * Eraser is free software: you can redistribute it and/or modify it under the
10 * terms of the GNU General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option) any later
12 * version.
13 *
14 * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 *
18 * A copy of the GNU General Public License can be found at
19 * <http://www.gnu.org/licenses/>.
20 */
21
22using System;
23using System.Collections.Generic;
24using System.Text;
25
26using System.Runtime.InteropServices;
27using System.Security.Cryptography;
28
29using Eraser.Util;
30using Eraser.Plugins;
31using Eraser.Plugins.ExtensionPoints;
32
33namespace Eraser.DefaultPlugins
34{
35    [Guid("6BF35B8E-F37F-476e-B6B2-9994A92C3B0C")]
36    class RngCrypto : PrngBase
37    {
38        public override string Name
39        {
40            get { return S._("RNGCryptoServiceProvider"); }
41        }
42
43        public override Guid Guid
44        {
45            get { return GetType().GUID; }
46        }
47
48        public override void NextBytes(byte[] buffer)
49        {
50            rand.GetBytes(buffer);
51        }
52
53        protected override void Reseed(byte[] seed)
54        {
55            //No-op. RNGCryptoServiceProviders can't be reseeded.
56        }
57
58        RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
59    }
60}
Note: See TracBrowser for help on using the repository browser.