This repository has been archived by the owner. It is now read-only.
SHA3 and SHAKE accelerator
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.resources
nist_test_vectors
.gitignore
LICENSE
readme.md
run_benchmark.py
run_example.py
run_nist_test.py

readme.md

AWS

SHA3 and SHAKE Application

This application is capable of hashing any file.

Features

  • Support: SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE-128, SHAKE-256
  • Remote or local execution facility
  • Easy to use Python API

Limitations

  • Performance of this accelerator is between 1x and 6x faster than CPU depending on the SHA3 algorithm and the size of the file to hash. Larger is the file, better is the acceleration factor.
  • Inputs and outputs can't be larger than 30GB.
  • See also limitations from API

Parameters

This section describes accelerator inputs and outputs.

Configuration parameters

No parameters required.

Processing parameters

Generic parameters:

  • file_in: Path to file to hash.

Specific parameters:

  • type: Hashing algorithm. Possibles values:
    • sha3-224: SHA3-224 algorithm
    • sha3-256: SHA3-256 algorithm
    • sha3-384: SHA3-384 algorithm
    • sha3-512: SHA3-512 algorithm
    • shake-128: SHAKE-128 algorithm
    • shake-256: SHAKE-256 algorithm
  • length: Length of the expected digest in SHAKE algorithm.

Processing output

Result is the hashing result.

Specific outputs:

  • digest: SHA3/SHAKE digest.

Getting started

The Apyfal Python library is required.

Apyfal is installed using PIP. Some installation options are available depending the host you want to use (See "Installation" in Apyfal documentation for more information).

You can install the full package with all options using:

pip install apyfal[all]

Using Accelerator with Apyfal

Running example

This example computes the sha3-224 for the run_example.py file. Make sure the accelerator.conf file has been completed before running the script.

You can clone a repository to get examples files, then move to the cloned directory:

git clone https://github.com/Accelize/sha3 --depth 1
cd sha3

You need to create and configure an accelerator.conf file to run the example. See "Configuration" in Apyfal documentation for more information.

You can run the example with Apyfal :

./run_example.py
  • To benchmark this solution with the standard openssl C++ library, use this command: python run_benchmark.py This script is hashing differente sizes of message from 1KB to 1GB for all the sha3 algorithms. Both It will produce a results.csv file that can be imported in a spreadsheet application.
  • To run this solution with the NIST test vectors, use this command: python run_nist_test.py

Using Apyfal step by step

This section explains how to run this particular accelerator. For explanation on Apyfal and host configuration, See "Getting Started" in Apyfal documentation.

import apyfal

# 1- Create Accelerator
with apyfal.Accelerator(accelerator='silex_sha3') as myaccel:
    
    # 2- Configure Accelerator and its host
    #    Note: This step can take some minutes depending the configured host
    myaccel.start()
    
    # 3- Process file
    myaccel.process()

Local execution on cloud instance

This section shows how to run the above example directly on host.

This example requires an host running the accelerator.

Creating cloud instance host using Apyfal CLI

You can easily generate a cloud instance host with Apyfal CLI

apyfal create --accelerator silex_sha3

apyfal start

And then connect to it with SSH (key_pair and ip_address values are printed by Apyfal CLI on start):

ssh -Yt -i ~/.ssh/${key_pair}.pem centos@${ip_address}

It is now possible to continue using Apyfal as Python library or as CLI, The example next steps will use the CLI.

Accelerator configuration

First, initialize the Apyfal CLI.

apyfal create

Like previously, start the accelerator:

apyfal start

Process with accelerator

Then, process with accelerator.

apyfal process

Terminate cloud instance with Apyfal CLI

From client computer, don't forget to terminate instance you have created with Apyfal once you have finished with it:

apyfal stop

Support and enhancement requests

Read the APYFAL FAQ

Contact us if you have any support or enhancement request