Skip to content

Commit

Permalink
ran clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
aviadingo committed Aug 11, 2024
1 parent 0678a2f commit 340f962
Show file tree
Hide file tree
Showing 11 changed files with 645 additions and 672 deletions.
80 changes: 38 additions & 42 deletions icicle/include/hash/blake2s/blake2s.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,45 @@
* This file is released into the Public Domain.
*/

#pragma once
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long long LONG;

#pragma once
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long long LONG;

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include "gpu-utils/device_context.cuh"
#include "gpu-utils/error_handler.cuh"

#include "hash/hash.cuh"
using namespace hash;
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include "gpu-utils/device_context.cuh"
#include "gpu-utils/error_handler.cuh"

namespace blake2s{
#define BLAKE2S_ROUNDS 10
#define BLAKE2S_BLOCK_LENGTH 64
#define BLAKE2S_CHAIN_SIZE 8
#define BLAKE2S_CHAIN_LENGTH (BLAKE2S_CHAIN_SIZE * sizeof(uint32_t))
#define BLAKE2S_STATE_SIZE 16
#define BLAKE2S_STATE_LENGTH (BLAKE2S_STATE_SIZE * sizeof(uint32_t))
#include "hash/hash.cuh"
using namespace hash;

class Blake2s : public Hasher<BYTE, BYTE>
{
public:
cudaError_t run_hash_many_kernel(
const BYTE* input,
BYTE* output,
WORD number_of_states,
WORD input_len,
WORD output_len,
const device_context::DeviceContext& ctx) const override;


Blake2s()
: Hasher<BYTE, BYTE>(BLAKE2S_STATE_SIZE, BLAKE2S_STATE_SIZE, BLAKE2S_STATE_SIZE, 0)
{
}
};
namespace blake2s {
#define BLAKE2S_ROUNDS 10
#define BLAKE2S_BLOCK_LENGTH 64
#define BLAKE2S_CHAIN_SIZE 8
#define BLAKE2S_CHAIN_LENGTH (BLAKE2S_CHAIN_SIZE * sizeof(uint32_t))
#define BLAKE2S_STATE_SIZE 16
#define BLAKE2S_STATE_LENGTH (BLAKE2S_STATE_SIZE * sizeof(uint32_t))

extern "C" {
void mcm_cuda_blake2s_hash_batch(BYTE *key, WORD keylen, BYTE *in, WORD inlen, BYTE *out, WORD output_len, WORD n_batch);
}
}
class Blake2s : public Hasher<BYTE, BYTE>
{
public:
cudaError_t run_hash_many_kernel(
const BYTE* input,
BYTE* output,
WORD number_of_states,
WORD input_len,
WORD output_len,
const device_context::DeviceContext& ctx) const override;

Blake2s() : Hasher<BYTE, BYTE>(BLAKE2S_STATE_SIZE, BLAKE2S_STATE_SIZE, BLAKE2S_STATE_SIZE, 0) {}
};

extern "C" {
void
mcm_cuda_blake2s_hash_batch(BYTE* key, WORD keylen, BYTE* in, WORD inlen, BYTE* out, WORD output_len, WORD n_batch);
}
} // namespace blake2s
8 changes: 4 additions & 4 deletions icicle/src/hash/blake2s/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ test_blake2s_batched: test_blake2s_batched.cu blake2s.cu
nvcc -o test_blake2s_batched -I. -I../../../include test_blake2s_batched.cu -g
./test_blake2s_batched ./batched_test_vectors.csv

test_blake2s_hasher: test_blake2s_hasher.cu blake2s.cu
nvcc -o test_blake2s_hasher -I. -I../../../include test_blake2s_hasher.cu -g
./test_blake2s_hasher
test_blake2s_integ: test_blake2s_integ.cu blake2s.cu
nvcc -o test_blake2s_integ -I. -I../../../include test_blake2s_integ.cu -g
./test_blake2s_integ

test_blake2s_seq: test_blake2s_seq.cu blake2s.cu
nvcc -o test_blake2s_seq -I. -I../../../include test_blake2s_seq.cu -g
Expand All @@ -23,4 +23,4 @@ test_blake2s_tree: test_tree.cu blake2s.cu ../../merkle-tree/merkle.cu
./test_blake2s_tree

clear:
rm test_blake2s test_blake2s_tree test_blake2s_hasher test_blake2s_seq test_blake2s_seq_sa test_blake2s_batched
rm test_blake2s test_blake2s_tree test_blake2s_integ test_blake2s_seq test_blake2s_seq_sa test_blake2s_batched
Loading

0 comments on commit 340f962

Please sign in to comment.