diff options
author | Tim Whittington <bc@whittington.net.nz> | 2013-10-19 21:22:38 +1300 |
---|---|---|
committer | Tim Whittington <bc@whittington.net.nz> | 2013-10-19 21:22:38 +1300 |
commit | e0f740ffbb612544f63049ae3cc12a876014d6cc (patch) | |
tree | d90b5b27eb79749120aca7833c8998123c9f406f /crypto/src | |
parent | Make ChaCha and Salsa20 engines CLSCompliant. (diff) | |
download | BouncyCastle.NET-ed25519-e0f740ffbb612544f63049ae3cc12a876014d6cc.tar.xz |
Use xmldoc for documentation of Salsa20/XSalsa20/ChaCha
Diffstat (limited to 'crypto/src')
-rw-r--r-- | crypto/src/crypto/engines/ChaChaEngine.cs | 33 | ||||
-rw-r--r-- | crypto/src/crypto/engines/Salsa20Engine.cs | 28 | ||||
-rw-r--r-- | crypto/src/crypto/engines/XSalsa20Engine.cs | 21 |
3 files changed, 37 insertions, 45 deletions
diff --git a/crypto/src/crypto/engines/ChaChaEngine.cs b/crypto/src/crypto/engines/ChaChaEngine.cs index 2aeb30d86..f4a7b8fe1 100644 --- a/crypto/src/crypto/engines/ChaChaEngine.cs +++ b/crypto/src/crypto/engines/ChaChaEngine.cs @@ -3,24 +3,24 @@ using Org.BouncyCastle.Crypto.Utilities; namespace Org.BouncyCastle.Crypto.Engines { - /** - * Implementation of Daniel J. Bernstein's ChaCha stream cipher. - */ + /// <summary> + /// Implementation of Daniel J. Bernstein's ChaCha stream cipher. + /// </summary> public class ChaChaEngine : Salsa20Engine { - /** - * Creates a 20 rounds ChaCha engine. - */ + /// <summary> + /// Creates a 20 rounds ChaCha engine. + /// </summary> public ChaChaEngine() { } - /** - * Creates a ChaCha engine with a specific number of rounds. - * @param rounds the number of rounds (must be an even number). - */ + /// <summary> + /// Creates a ChaCha engine with a specific number of rounds. + /// </summary> + /// <param name="rounds">the number of rounds (must be an even number).</param> public ChaChaEngine(int rounds) : base(rounds) { @@ -93,13 +93,12 @@ namespace Org.BouncyCastle.Crypto.Engines Pack.UInt32_To_LE(x, output, 0); } - /** - * ChacCha function - * - * @param input input data - * - * @return keystream - */ + /// <summary> + /// ChacCha function. + /// </summary> + /// <param name="rounds">The number of ChaCha rounds to execute</param> + /// <param name="input">The input words.</param> + /// <param name="x">The ChaCha state to modify.</param> internal static void ChachaCore(int rounds, uint[] input, uint[] x) { if (input.Length != 16) { diff --git a/crypto/src/crypto/engines/Salsa20Engine.cs b/crypto/src/crypto/engines/Salsa20Engine.cs index aff6320b1..81884d603 100644 --- a/crypto/src/crypto/engines/Salsa20Engine.cs +++ b/crypto/src/crypto/engines/Salsa20Engine.cs @@ -7,9 +7,9 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { - /** - * Implementation of Daniel J. Bernstein's Salsa20 stream cipher, Snuffle 2005 - */ + /// <summary> + /// Implementation of Daniel J. Bernstein's Salsa20 stream cipher, Snuffle 2005 + /// </summary> public class Salsa20Engine : IStreamCipher { @@ -39,18 +39,18 @@ namespace Org.BouncyCastle.Crypto.Engines */ private uint cW0, cW1, cW2; - /** - * Creates a 20 round Salsa20 engine. - */ + /// <summary> + /// Creates a 20 round Salsa20 engine. + /// </summary> public Salsa20Engine() : this(DEFAULT_ROUNDS) { } - /** - * Creates a Salsa20 engine with a specific number of rounds. - * @param rounds the number of rounds (must be an even number). - */ + /// <summary> + /// Creates a Salsa20 engine with a specific number of rounds. + /// </summary> + /// <param name="rounds">the number of rounds (must be an even number).</param> public Salsa20Engine(int rounds) { if (rounds <= 0 || (rounds & 1) != 0) @@ -61,14 +61,6 @@ namespace Org.BouncyCastle.Crypto.Engines this.rounds = rounds; } - /** - * initialise a Salsa20 cipher. - * - * @param forEncryption whether or not we are for encryption. - * @param params the parameters required to set up the cipher. - * @exception ArgumentException if the params argument is - * inappropriate. - */ public void Init( bool forEncryption, ICipherParameters parameters) diff --git a/crypto/src/crypto/engines/XSalsa20Engine.cs b/crypto/src/crypto/engines/XSalsa20Engine.cs index 6d61c32cd..fc6630905 100644 --- a/crypto/src/crypto/engines/XSalsa20Engine.cs +++ b/crypto/src/crypto/engines/XSalsa20Engine.cs @@ -4,11 +4,12 @@ using Org.BouncyCastle.Crypto.Utilities; namespace Org.BouncyCastle.Crypto.Engines { - /** - * Implementation of Daniel J. Bernstein's XSalsa20 stream cipher - Salsa20 with an extended nonce. - * <p> - * XSalsa20 requires a 256 bit key, and a 192 bit nonce. - */ + /// <summary> + /// Implementation of Daniel J. Bernstein's XSalsa20 stream cipher - Salsa20 with an extended nonce. + /// </summary> + /// <remarks> + /// XSalsa20 requires a 256 bit key, and a 192 bit nonce. + /// </remarks> public class XSalsa20Engine : Salsa20Engine { @@ -23,11 +24,11 @@ namespace Org.BouncyCastle.Crypto.Engines get { return 24; } } - /** - * XSalsa20 key generation: process 256 bit input key and 128 bits of the input nonce - * using a core Salsa20 function without input addition to produce 256 bit working key - * and use that with the remaining 64 bits of nonce to initialize a standard Salsa20 engine state. - */ + /// <summary> + /// XSalsa20 key generation: process 256 bit input key and 128 bits of the input nonce + /// using a core Salsa20 function without input addition to produce 256 bit working key + /// and use that with the remaining 64 bits of nonce to initialize a standard Salsa20 engine state. + /// </summary> protected override void SetKey(byte[] keyBytes, byte[] ivBytes) { if (keyBytes.Length != 32) |