Skip to content

Commit

Permalink
gguf-hash: remove clib sha256 attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
mofosyne committed Jun 22, 2024
1 parent f01de1a commit a410d23
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 331 deletions.
4 changes: 2 additions & 2 deletions examples/gguf-hash/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ install(TARGETS ${TARGET} RUNTIME)
# clibs dependencies
include_directories(deps/)
add_library(xxhash OBJECT deps/xxhash/xxhash.c deps/xxhash/xxhash.h)
target_link_libraries(${TARGET} PRIVATE xxhash)
add_library(sha1 OBJECT deps/sha1/sha1.c deps/sha1/sha1.h)
add_library(sha256 OBJECT deps/sha256/sha256.c deps/sha256/sha256.h)
target_link_libraries(${TARGET} PRIVATE sha1 sha256 xxhash)
target_link_libraries(${TARGET} PRIVATE sha1)

target_link_libraries(${TARGET} PRIVATE ggml ${CMAKE_THREAD_LIBS_INIT})
target_compile_features(${TARGET} PRIVATE cxx_std_11)
14 changes: 6 additions & 8 deletions examples/gguf-hash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@ CLI to hash GGUF files.

- `--xxhash`: use xhash (default)
- `--sha1`: use sha1
- `--sha256`: use sha256

### Compile Example

```
cmake -B build
make -C build llama-gguf-hash
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DLLAMA_FATAL_WARNINGS=ON
make -C build clean
make -C build llama-gguf-hash VERBOSE=1
./build/bin/llama-gguf-hash test.gguf
./build/bin/llama-gguf-hash --xxhash test.gguf
./build/bin/llama-gguf-hash --sha1 test.gguf
./build/bin/llama-gguf-hash --sha256 test.gguf
```

### Crypto/Hash Libaries Used
### Crypto/Hash Libraries Used

These small clibs was installed via the [clib c package manager](https://github.com/clibs)
These micro c libraries dependencies was installed via the [clib c package manager](https://github.com/clibs)

- https://github.com/clibs/sha1/
- https://github.com/Cyan4973/xxHash
- https://github.com/mofosyne/xxHash
- https://github.com/clibs/sha1/
13 changes: 0 additions & 13 deletions examples/gguf-hash/deps/rotate-bits/package.json

This file was deleted.

46 changes: 0 additions & 46 deletions examples/gguf-hash/deps/rotate-bits/rotate-bits.h

This file was deleted.

15 changes: 0 additions & 15 deletions examples/gguf-hash/deps/sha256/package.json

This file was deleted.

221 changes: 0 additions & 221 deletions examples/gguf-hash/deps/sha256/sha256.c

This file was deleted.

24 changes: 0 additions & 24 deletions examples/gguf-hash/deps/sha256/sha256.h

This file was deleted.

5 changes: 3 additions & 2 deletions examples/gguf-hash/gguf-hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

#include "xxhash/xxhash.h"
#include "sha1/sha1.h"
#include "sha256/sha256.h"

//#define SHA256
#ifdef SHA256 // TODO: https://github.com/jb55/sha256.c
#include "sha256/sha256.h"
#endif

struct hash_params {
std::string input;
Expand Down

0 comments on commit a410d23

Please sign in to comment.