SimonSpeckNet 0.3.0

SIMON and SPECK are families of lightweight block ciphers; those block ciphers are efficient and provide high performances across a wide range of devices. This package includes classes that allow you to encrypt and decrypt using native libraries that are using SIMD such as AVX2 or NEON.

Install-Package SimonSpeckNet -Version 0.3.0
dotnet add package SimonSpeckNet --version 0.3.0
<PackageReference Include="SimonSpeckNet" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimonSpeckNet --version 0.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Build Status
Windows Build status
Coverity Scan Build Status
NuGet version
FOSSA Status

simon-speck-net

c# wrapper implement of Naruto/simon-speck-c

simon and speck are lightweight block cipher algorithms, published by NSA.(iadgov/simon-speck)

support platforms are Desktop Platforms(Windows, macOS, Linux), Xamarin iOS and MonoAndroid.

Supports

  • algorithms and block sizes, key sizes and modes
    • speck ECB
      • 128/128
      • 128/192
      • 128/256
    • speck CTR
      • 128/128
      • 128/192
      • 128/256
  • platforms, architectures
    • windows x64
    • macOS x64
    • linux x64
    • Xamarin iOS
    • MonoAndroid

Sample

simple encrypt and decrypt code.

String plainText = "test text abcdefg.";
byte[] plainByte = System.Text.Encoding.ASCII.GetBytes(plainText);

// Speck ECB mode
using (SymmetricAlgorithm algo = new Speck())
{
    algo.BlockSize = 128;
    algo.KeySize = 128;
    
    algo.GenerateKey();
    using (ICryptoTransform encryptor = algo.CreateEncryptor() , decryptor = algo.CreateDecryptor())
    {
        byte[] plainEnc = encryptor.TransformFinalBlock(plainByte, 0, plainByte.Length);
        byte[] plainDec = decryptor.TransformFinalBlock(plainEnc, 0, plainEnc.Length);
        Console.WriteLine(System.Text.Encoding.ASCII.GetString(plainDec));
        Console.WriteLine();
    }
}

// Speck CTR mode
using (SymmetricAlgorithm algo = new SpeckCTR())
{
    algo.BlockSize = 128;
    algo.KeySize = 128;
    
    algo.GenerateIV();
    algo.GenerateKey();
    using (ICryptoTransform encryptor = algo.CreateEncryptor() , decryptor = algo.CreateDecryptor())
    {
        byte[] plainEnc = encryptor.TransformFinalBlock(plainByte, 0, plainByte.Length);
        byte[] plainDec = decryptor.TransformFinalBlock(plainEnc, 0, plainEnc.Length);
        Console.WriteLine(System.Text.Encoding.ASCII.GetString(plainDec));
        Console.WriteLine();
    }
}

development

preapre

  • mono
  • Unity (if create unity package)

get source

git clone --recursive git@github.com:Naruto/simon-speck-net.git

build

build simon-speck-net and nunit test.

cd /path/to/simon-speck-net
cd ./net
mono .nuget/nuget.exe restore
xbuild /p:TargetFrameworkVersion="v4.5" /p:Configuration=Release
mono ./packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe ./speckTest/bin/Release/speckTest.dll

or

cd /path/to/simon-speck-net
./scripts/build.sh

create nuget package

cd /path/to/simon-speck-net
./scripts/create_nuget.sh

SimonSpeckNet nuget package file is outputted to out/net directory.

create unity package

cd /path/to/simon-speck-net
./scripts/create_unitypackage.sh

SimonSpeckNet unitypackage file is outputted to out/unity directory.

update native library

update simon-speck-c sumobule

git submodule update --init --recursive

Android

export NDK_ROOT=/path/to/android-ndk-path
./scripts/plugins/deploy_android.sh

deploy each archtectures library files to net/plugins/Android/libs

iOS

./scripts/pluginsdeploy_ios.sh

deploy fat library file to net/plugins/iOS

Linux

./scripts/plugins/deploy_linux.sh

deploy .so file to net/plugins/x64

macOS

./scripts/plugins/deploy_mac.sh

deploy .dylib and .bundle files to net/plugins/x64

Windows

T.B.D

License

FOSSA Status

Build Status
Windows Build status
Coverity Scan Build Status
NuGet version
FOSSA Status

simon-speck-net

c# wrapper implement of Naruto/simon-speck-c

simon and speck are lightweight block cipher algorithms, published by NSA.(iadgov/simon-speck)

support platforms are Desktop Platforms(Windows, macOS, Linux), Xamarin iOS and MonoAndroid.

Supports

  • algorithms and block sizes, key sizes and modes
    • speck ECB
      • 128/128
      • 128/192
      • 128/256
    • speck CTR
      • 128/128
      • 128/192
      • 128/256
  • platforms, architectures
    • windows x64
    • macOS x64
    • linux x64
    • Xamarin iOS
    • MonoAndroid

Sample

simple encrypt and decrypt code.

String plainText = "test text abcdefg.";
byte[] plainByte = System.Text.Encoding.ASCII.GetBytes(plainText);

// Speck ECB mode
using (SymmetricAlgorithm algo = new Speck())
{
    algo.BlockSize = 128;
    algo.KeySize = 128;
    
    algo.GenerateKey();
    using (ICryptoTransform encryptor = algo.CreateEncryptor() , decryptor = algo.CreateDecryptor())
    {
        byte[] plainEnc = encryptor.TransformFinalBlock(plainByte, 0, plainByte.Length);
        byte[] plainDec = decryptor.TransformFinalBlock(plainEnc, 0, plainEnc.Length);
        Console.WriteLine(System.Text.Encoding.ASCII.GetString(plainDec));
        Console.WriteLine();
    }
}

// Speck CTR mode
using (SymmetricAlgorithm algo = new SpeckCTR())
{
    algo.BlockSize = 128;
    algo.KeySize = 128;
    
    algo.GenerateIV();
    algo.GenerateKey();
    using (ICryptoTransform encryptor = algo.CreateEncryptor() , decryptor = algo.CreateDecryptor())
    {
        byte[] plainEnc = encryptor.TransformFinalBlock(plainByte, 0, plainByte.Length);
        byte[] plainDec = decryptor.TransformFinalBlock(plainEnc, 0, plainEnc.Length);
        Console.WriteLine(System.Text.Encoding.ASCII.GetString(plainDec));
        Console.WriteLine();
    }
}

development

preapre

  • mono
  • Unity (if create unity package)

get source

git clone --recursive git@github.com:Naruto/simon-speck-net.git

build

build simon-speck-net and nunit test.

cd /path/to/simon-speck-net
cd ./net
mono .nuget/nuget.exe restore
xbuild /p:TargetFrameworkVersion="v4.5" /p:Configuration=Release
mono ./packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe ./speckTest/bin/Release/speckTest.dll

or

cd /path/to/simon-speck-net
./scripts/build.sh

create nuget package

cd /path/to/simon-speck-net
./scripts/create_nuget.sh

SimonSpeckNet nuget package file is outputted to out/net directory.

create unity package

cd /path/to/simon-speck-net
./scripts/create_unitypackage.sh

SimonSpeckNet unitypackage file is outputted to out/unity directory.

update native library

update simon-speck-c sumobule

git submodule update --init --recursive

Android

export NDK_ROOT=/path/to/android-ndk-path
./scripts/plugins/deploy_android.sh

deploy each archtectures library files to net/plugins/Android/libs

iOS

./scripts/pluginsdeploy_ios.sh

deploy fat library file to net/plugins/iOS

Linux

./scripts/plugins/deploy_linux.sh

deploy .so file to net/plugins/x64

macOS

./scripts/plugins/deploy_mac.sh

deploy .dylib and .bundle files to net/plugins/x64

Windows

T.B.D

License

FOSSA Status

Release Notes

- version up simon-speck-c to v0.6
- change SpeckCTR default padding mode to `Padding.None`
- SpeckCTR allows any length data when setting `Padding.None`. And return values length is same as input data length.

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.3.0 1,745 10/4/2017
0.2.0 242 9/30/2017
0.1.2 203 9/22/2017