| [1359] | 1 | /* |
|---|
| 2 | * $Id$ |
|---|
| [1675] | 3 | * Copyright 2008-2010 The Eraser Project |
|---|
| [1359] | 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 | |
|---|
| 22 | using System; |
|---|
| 23 | using System.Collections.Generic; |
|---|
| 24 | using System.Text; |
|---|
| [2368] | 25 | |
|---|
| [1359] | 26 | using System.Runtime.InteropServices; |
|---|
| [2368] | 27 | using System.Security.Cryptography; |
|---|
| [1359] | 28 | |
|---|
| 29 | using Eraser.Util; |
|---|
| [2368] | 30 | using Eraser.Plugins; |
|---|
| 31 | using Eraser.Plugins.ExtensionPoints; |
|---|
| [1359] | 32 | |
|---|
| 33 | namespace Eraser.DefaultPlugins |
|---|
| 34 | { |
|---|
| 35 | [Guid("6BF35B8E-F37F-476e-B6B2-9994A92C3B0C")] |
|---|
| [2459] | 36 | class RngCrypto : PrngBase |
|---|
| [1359] | 37 | { |
|---|
| [2459] | 38 | public override string Name |
|---|
| [1359] | 39 | { |
|---|
| 40 | get { return S._("RNGCryptoServiceProvider"); } |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| [2459] | 43 | public override Guid Guid |
|---|
| [1359] | 44 | { |
|---|
| [1802] | 45 | get { return GetType().GUID; } |
|---|
| [1359] | 46 | } |
|---|
| 47 | |
|---|
| [2459] | 48 | public override void NextBytes(byte[] buffer) |
|---|
| [1359] | 49 | { |
|---|
| 50 | rand.GetBytes(buffer); |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| [2459] | 53 | protected override void Reseed(byte[] seed) |
|---|
| [1359] | 54 | { |
|---|
| 55 | //No-op. RNGCryptoServiceProviders can't be reseeded. |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); |
|---|
| 59 | } |
|---|
| 60 | } |
|---|