Comments (2)
Incorrect Indeed
It ought to return dd6534d1ba953a02a1c4e8f29ee5d54d8dd43591d735e67f885b2c56f0051bdc
but returns bcd7fdea9a0b1dc7f84f1dc1229e3bff8fa4c2802b27ee392acbd1a5d3784062
#include "sha256.cuh"
#include <stdint.h>
#include <stdio.h>
__global__ void sha256_cuda(BYTE *input, BYTE *output, size_t length) {
SHA256_CTX ctx;
sha256_init(&ctx);
sha256_update(&ctx, input, length);
sha256_final(&ctx, output);
}
int main() {
const BYTE message_hash[] = {
0xdd, 0xab, 0x86, 0x14, 0x43, 0x87, 0xd2, 0xe1,
0x84, 0xc4, 0x29, 0x5c, 0x85, 0xc7, 0xce, 0xf3,
0xc5, 0xcc, 0x83, 0x87, 0x7d, 0x9f, 0x91, 0x98,
0x27, 0x80, 0xae, 0x66, 0x22, 0x0b, 0xb1, 0xaf
};
BYTE output[SHA256_BLOCK_SIZE];
BYTE *d_input, *d_output;
cudaMalloc((void **)&d_input, sizeof(message_hash));
cudaMalloc((void **)&d_output, SHA256_BLOCK_SIZE);
cudaMemcpy(d_input, message_hash, sizeof(message_hash), cudaMemcpyHostToDevice);
sha256_cuda<<<1, 1>>>(d_input, d_output, sizeof(message_hash));
cudaMemcpy(output, d_output, SHA256_BLOCK_SIZE, cudaMemcpyDeviceToHost);
for (int i = 0; i < SHA256_BLOCK_SIZE; i++)
printf("%02x", output[i]);
printf("\n");
cudaFree(d_input);
cudaFree(d_output);
return 0;
}
···
from cudasha256.
Hi guys, this was a school project, from long ago, if you have ideas how to fix it feel free to do a PR, I will merge it. Im not planning to maintain / fix / improve this.
from cudasha256.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cudasha256.