< Summary

Information
Class: Renci.SshNet.Security.Chaos.NaCl.Internal.Salsa.Salsa20
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\Chaos.NaCl\Internal\Salsa\Salsa20.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 27
Coverable lines: 27
Total lines: 45
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
HSalsa20(...)100%10%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\Chaos.NaCl\Internal\Salsa\Salsa20.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3
 4namespace Renci.SshNet.Security.Chaos.NaCl.Internal.Salsa
 5{
 6    internal class Salsa20
 7    {
 8        public const uint SalsaConst0 = 0x61707865;
 9        public const uint SalsaConst1 = 0x3320646e;
 10        public const uint SalsaConst2 = 0x79622d32;
 11        public const uint SalsaConst3 = 0x6b206574;
 12
 13        internal static void HSalsa20(byte[] output, int outputOffset, byte[] key, int keyOffset, byte[] nonce, int nonc
 014        {
 15            Array16<UInt32> state;
 016            state.x0 = SalsaConst0;
 017            state.x1 = ByteIntegerConverter.LoadLittleEndian32(key, keyOffset + 0);
 018            state.x2 = ByteIntegerConverter.LoadLittleEndian32(key, keyOffset + 4);
 019            state.x3 = ByteIntegerConverter.LoadLittleEndian32(key, keyOffset + 8);
 020            state.x4 = ByteIntegerConverter.LoadLittleEndian32(key, keyOffset + 12);
 021            state.x5 = SalsaConst1;
 022            state.x6 = ByteIntegerConverter.LoadLittleEndian32(nonce, nonceOffset + 0);
 023            state.x7 = ByteIntegerConverter.LoadLittleEndian32(nonce, nonceOffset + 4);
 024            state.x8 = ByteIntegerConverter.LoadLittleEndian32(nonce, nonceOffset + 8);
 025            state.x9 = ByteIntegerConverter.LoadLittleEndian32(nonce, nonceOffset + 12);
 026            state.x10 = SalsaConst2;
 027            state.x11 = ByteIntegerConverter.LoadLittleEndian32(key, keyOffset + 16);
 028            state.x12 = ByteIntegerConverter.LoadLittleEndian32(key, keyOffset + 20);
 029            state.x13 = ByteIntegerConverter.LoadLittleEndian32(key, keyOffset + 24);
 030            state.x14 = ByteIntegerConverter.LoadLittleEndian32(key, keyOffset + 28);
 031            state.x15 = SalsaConst3;
 32
 033            SalsaCore.HSalsa(out state, ref state, 20);
 34
 035            ByteIntegerConverter.StoreLittleEndian32(output, outputOffset + 0, state.x0);
 036            ByteIntegerConverter.StoreLittleEndian32(output, outputOffset + 4, state.x5);
 037            ByteIntegerConverter.StoreLittleEndian32(output, outputOffset + 8, state.x10);
 038            ByteIntegerConverter.StoreLittleEndian32(output, outputOffset + 12, state.x15);
 039            ByteIntegerConverter.StoreLittleEndian32(output, outputOffset + 16, state.x6);
 040            ByteIntegerConverter.StoreLittleEndian32(output, outputOffset + 20, state.x7);
 041            ByteIntegerConverter.StoreLittleEndian32(output, outputOffset + 24, state.x8);
 042            ByteIntegerConverter.StoreLittleEndian32(output, outputOffset + 28, state.x9);
 043        }
 44    }
 45}