SHA256 Compute Shader (Kernel) Written in Rust

Overview

SHA256 Compute Shader (Kernel) Written in Rust

... with application to Validating the Bitcoin Blockchain


Abstract

The project consists of two primary goals: 1) implement kernels that validate several blocks' SHA256 hash in the Bitcoin Blockchain in parallel, and 2) investigate using the open-source Vulkan standard as an alternative to CUDA. When compared to an equivalent sequential program run on the CPU, the open source tools were approximately 5 times slower than the sequential algorithm, and the proprietary CUDA was approximately 2 times as fast as the sequential algorithm.

SHA256 on GPU

SHA256 algorithm itself is primarily a sequential algorithm. However, for a variety of applications being able to hash many items in a parallel fashion can be quite beneficial. As an example, we specifically looked at validating the bitcoin blockchain as a benchmark. We compared the Vulkan/Rust API with a CUDA/C implementation.

Read the Full Report.

WebGPU, Vulkan, and Rust-GPU

We implemented the SHA256 algorithm in Rust and compiled it to SPIR-V using using rust-gpu. The shader was then loaded to a Vulkan backend using wgpu-rs with its Rust bindings to WebGPU.

To see more details, visit the vulkan directory.

Compile the code

Build the C / CPU, CUDA code

make -C c

Build the Rust / Vulkan code

cd vulkan && cargo build --release && cd ..

Generate a plot yourself

./plotboi.py ./bitcoin/block_data.csv

display ./docs/figs/performance_plot.png

Licensing Details

This project contains several files directly copied from the OpenSSL project (https://github.com/openssl/openssl), which is under the Apache 2.0 Licence.

The files in question are:

  • c/include/md32_common.h

  • c/include/sha256.h

  • c/src/sha256.c

You might also like...
A Rust crate that simplifies the integration of Rust and eBPF programs written in C.

This crate simplifies the compilation of eBPF programs written in C integrating clang with Rust and the cargo build system with functions that can be

My computer graphics playground. Currently has a raytracer implemented with D3D11 compute shader.
My computer graphics playground. Currently has a raytracer implemented with D3D11 compute shader.

Graphics Playground I use this project as my "toy" engine. I'll be implementing various graphics projects in this repository. The code here is not sui

Cycles Shader Editor is a cross-platform C++ library that provides a graphical editor for creating Cycles shader graphs

Cycles Shader Editor Cycles Shader Editor is a cross-platform C++ library that provides a graphical editor for creating Cycles shader graphs with a si

A cross platform shader language with multi-threaded offline compilation or platform shader source code generation
A cross platform shader language with multi-threaded offline compilation or platform shader source code generation

A cross platform shader language with multi-threaded offline compilation or platform shader source code generation. Output json reflection info and c++ header with your shaders structs, fx-like techniques and compile time branch evaluation via (uber-shader) "permutations".

Shader Playground is a website for exploring shader compilers.
Shader Playground is a website for exploring shader compilers.

Shader Playground is a website for exploring shader compilers. Visit website Supported backends Compilers ANGLE Clspv DXC FXC Glslan

Shader cross compiler to translate HLSL (Shader Model 4 and 5) to GLSL
Shader cross compiler to translate HLSL (Shader Model 4 and 5) to GLSL

XShaderCompiler ("Cross Shader Compiler") Features Cross compiles HLSL shader code (Shader Model 4 and 5) into GLSL Simple to integrate into other pro

The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation

DirectX Shader Compiler The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) pr

Fork of SSH2DOS with more up to date cipher and SHA256 support

SSH2DOS v0.2.1+SHA256.1 patch by Antti Takala https://github.com/AnttiTakala/SSH2DOS Released on 04-14-2021 The aim was to update the ciphers and pro

a header-file-only, SHA256 hash generator in C++

PicoSHA2 - a C++ SHA256 hash generator Copyright © 2017 okdshin Introduction PicoSHA2 is a tiny SHA256 hash generator for C++ with following propertie

Implementation and console application of Sha256 hash function.
Implementation and console application of Sha256 hash function.

Sha256 WARNING: This repository was the first version of Sha256, for a newer one check RedLibrary. What is it? This is an implementation and console a

Integration of Rust code with a C Kernel Module

Rust-Kernel-Mod Description Integration of Rust code with a C Kernel Module This project sets up a minimalistic Linux kernel module in C which it uses

Minimal freestanding C library for kernel dev. Think Rust's libcore but for C. (memutils, string formatting, etc)

Libcore Minimal freestanding C library. Features String formatting. Memory utils memcpy memmove memcmp String utils strlen strncpy strncmp Serial driv

udbg's windows driver written in rust

This is the code of windows driver used in udbg, it contains the basic function used in udbg's 'krnl' adaptor, such as memory read/write, and it integ

Shellcode loader written in rust. Strives to evade modern EDR solutions.

Pestilence What is pestilence? Pestilence is a shellcode loader written in rust. It strives to evade modern EDR solutions. How does it work? It loads

⚡️Lightning-fast linter for .env files. Written in Rust 🦀

⚡️ Lightning-fast linter for .env files. Written in Rust 🦀 Dotenv-linter can check / fix / compare .env files for problems that may cause the applica

X terminal emulator rendering through OpenGL ES Compute Shaders

Zutty is a terminal emulator for the X Window System, functionally similar to several other X terminal emulators such as xterm, rxvt and countless others

 Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference
Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference

Edge ML Library (EMLL) offers optimized basic routines like general matrix multiplications (GEMM) and quantizations, to speed up machine learning (ML) inference on ARM-based devices. EMLL supports fp32, fp16 and int8 data types. EMLL accelerates on-device NMT, ASR and OCR engines of Youdao, Inc.

 Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference
Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference

Edge ML Library (EMLL) offers optimized basic routines like general matrix multiplications (GEMM) and quantizations, to speed up machine learning (ML) inference on ARM-based devices. EMLL supports fp32, fp16 and int8 data types. EMLL accelerates on-device NMT, ASR and OCR engines of Youdao, Inc.

Benchmark framework of compute-in-memory based accelerators for deep neural network (inference engine focused)

DNN+NeuroSim V1.3 The DNN+NeuroSim framework was developed by Prof. Shimeng Yu's group (Georgia Institute of Technology). The model is made publicly a

Owner
Daniel
A computer science, mathematics, and quantum computing enthusiast.
Daniel
a header-file-only, SHA256 hash generator in C++

PicoSHA2 - a C++ SHA256 hash generator Copyright © 2017 okdshin Introduction PicoSHA2 is a tiny SHA256 hash generator for C++ with following propertie

Shintarou Okada 531 Dec 29, 2022
Implementation and console application of Sha256 hash function.

Sha256 WARNING: This repository was the first version of Sha256, for a newer one check RedLibrary. What is it? This is an implementation and console a

Mr.Red 1 Feb 13, 2022
wtf is a distributed, code-coverage guided, customizable, cross-platform snapshot-based fuzzer designed for attacking user and / or kernel-mode targets running on Microsoft Windows.

wtf is a distributed, code-coverage guided, customizable, cross-platform snapshot-based fuzzer designed for attacking user and / or kernel-mode targets running on Microsoft Windows.

Axel Souchet 1.1k Dec 30, 2022
Keystroke-level online anonymization kernel: obfuscates typing behavior at the device level.

Keystroke-level online anonymization kernel: obfuscates typing behavior at the device level.

Vinnie Monaco 362 Dec 25, 2022
Distributed, Encrypted, Fractured File System - A custom distributed file system written in C with FUSE

A custom FUSE-based filesystem that distributes encrypted shards of data across machines on a local network, allowing those files to be accessible from any machine.

Charles Averill 14 Nov 2, 2022
A small HOTP/TOTP SHA1 client written in C, depending only on libcrypto (OpenSSL)

A small HOTP/TOTP SHA1 client written in C, depending only on libcrypto (OpenSSL)

null 3 Jan 21, 2022
Small collection of tools written in C for ECC and bitcoin

ecctools Small collection of tools written in C for ECC and bitcoin Why this programs are written in C language? Well i like C language because compil

Luis Alberto 26 Dec 7, 2022
simple encryptor and decryptor for files written in c++

What this 3ndecf1le simple encryptor and decryptor for files written in c++ How To Setup 3ndecf1le sudo apt install g++;g++ encrypt.cpp -o encrypt;g++

sami 1 Jan 23, 2022
SM2 simple tool class(C++)/function(C) written using openssl EVP (Based on OpenSSL 1.1.1).

sm2-EVP This project is a simple sm2 tool class(C++)/function(C) written using openssl EVP. Capable Function Brief CPP C GenEcPairKey Generate SM2 Key

Sovea 6 Nov 26, 2022
GPU 3D signed distance field generator, written with DirectX 11 compute shader

GPU SDF Generator GPU 3D signed distance field generator, written with DirectX 11 compute shader Building git clone --recursive https://github.com/Air

Z Guan 30 Dec 13, 2022