horkyze / cudasha256 Goto Github PK
View Code? Open in Web Editor NEWSimple tool to calculate sha256 on GPU using Cuda
License: MIT License
Simple tool to calculate sha256 on GPU using Cuda
License: MIT License
Hi,
I get cudaError 30 (unknown error) while calling cudaMallocManaged.
I have Quadro K420 card with cc 3.0.
Do you have any idea about this error?
Thanks.
As the title says, the file API used does not allow working with files larger than 4 GB. With cards that have up to 24 GB of VRAM like 3090 RTX and with fast SSDs that would probably be a better use case than doing sha256 on a GPU for a bunch of small files where just the latency of the request is going to hide all the benefits of fast calculation.
Consider changing file API to something that can handle 64-bit file sizes, and consider using ptrdiff_t instead of char for pointer arithmetic.
HI @Horkyze!
I'd like to give this a go in a school project I'm working on, however there is no licence.md or information on reuse.
May I use it?
Hashing "hello world!" should return 7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9, and hashing that in a file works, when i try to use the api to hash "hello world!", it gives a totally incorrect hash.
(code that produces incorrect result)
#include <stdio.h>
#include <stdint.h>
#include "sha256.cuh"
__global__ void seedHash()
{
uint8_t testInput[] = "hello world!";
//memcpy(byteArray, &seed, sizeof(uint64_t));
uint8_t byteArray[32];
SHA256_CTX sha;
sha256_init(&sha);
sha256_update(&sha, testInput, 12);
sha256_final(&sha, byteArray);
printf("Hash output: ");
for (int i = 0; i < 32; i++) printf("%.2x", byteArray[i]);
printf("\n");
}
int main()
{
//cudaSetDevice(1);
seedHash<<<1,1>>>();
cudaDeviceSynchronize();
}
I was trying to use your code as a starting point to make a sha256 cuda hasher that takes lines from stdin (Or any text file) and hashes each line as a job (Outputing HASH and Original Line in the output separated by a space or other delimiter)
Your program is so close to doing this (You hash filesystem files), but my c++ is weak. Can you assist me? The way you read the files in for the โf switch, but instead of getting the file data from get_file_data, could you just hash the string?
Hello, may I ask for your help?
After I modify the code, I get an incorrect hash value.
buff = (BYTE *)"abc";
checkCudaErrors(cudaMallocManaged(&buff, (3)*sizeof(char)));
jobs[i] = JOB_init(buff, 3, argv[index]);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.