Skip to content

Commit 1b2d0ef

Browse files
VinnyOGPawel Czarnecki
authored and
Pawel Czarnecki
committed
Get libgit2 working for 8thwall. (#24)
Upgrade libgit2 with support for 8thwall cloud editor.
1 parent c438d0b commit 1b2d0ef

File tree

9 files changed

+690
-4
lines changed

9 files changed

+690
-4
lines changed

deps/picosha2/picosha2-c.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "picosha2-c.h"
2+
#include "picosha2.h"
3+
4+
#include <array>
5+
#include <cstring>
6+
#include <string>
7+
8+
extern "C" {
9+
10+
void picosha2_256(const char *buffer, int len, char *dest) {
11+
std::array<uint8_t, picosha2::k_digest_size> hash;
12+
picosha2::hash256(buffer, buffer + len, std::begin(hash), std::end(hash));
13+
std::string sha256 =
14+
picosha2::bytes_to_hex_string(std::begin(hash), std::end(hash));
15+
std::memcpy(dest, sha256.c_str(), sha256.size() + 1);
16+
}
17+
}

deps/picosha2/picosha2-c.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef INCLUDE_picosha2_c_h__
2+
#define INCLUDE_picosha2_c_h__
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
void picosha2_256(const char* buffer, int len, char* dest);
9+
10+
#ifdef __cplusplus
11+
}
12+
#endif
13+
14+
#endif

0 commit comments

Comments
 (0)