1
0
Fork 0
mirror of https://github.com/eosswedenorg/libantelope synced 2026-06-17 12:00:02 +02:00

Change namespace and header guards from libeosio to libantelope

This commit is contained in:
Henrik Hautakoski 2023-04-06 14:23:05 +02:00
parent 0cfd459c71
commit 6824a2f49e
32 changed files with 176 additions and 176 deletions

View file

@ -23,12 +23,12 @@
*/
#include <iostream>
#include <cstring>
#include <libeosio/base58.hpp>
#include <libeosio/checksum.hpp>
#include <libeosio/WIF.hpp>
#include <libantelope/base58.hpp>
#include <libantelope/checksum.hpp>
#include <libantelope/WIF.hpp>
#include "wif/codec.hpp"
namespace libeosio {
namespace libantelope {
const std::string WIF_PUB_LEG = "EOS";
const std::string WIF_PUB_K1 = "PUB_K1_";
@ -154,4 +154,4 @@ std::string wif_sig_encode(const ec_signature_t& sig) {
return WIF_SIG_K1 + base58_encode(buf, buf + sizeof(buf));
}
} // namespace libeosio
} // namespace libantelope

View file

@ -28,9 +28,9 @@
#include <cstddef>
#include <cassert>
#include <cstring>
#include <libeosio/base58.hpp>
#include <libantelope/base58.hpp>
namespace libeosio {
namespace libantelope {
static const char charmap[59] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
static const int8_t table[256] = {
@ -190,4 +190,4 @@ std::string& base58_strip(std::string &str) {
return str;
}
} // namespace libeosio
} // namespace libantelope

View file

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <libeosio/ec.hpp>
#include <libantelope/ec.hpp>
std::ostream& _hex(std::ostream& os, const unsigned char *b, std::size_t sz) {
os << "[ " << std::hex;
@ -38,10 +38,10 @@ std::ostream& _hex(std::ostream& os, const unsigned char *b, std::size_t sz) {
return os << std::oct << " ]";
}
std::ostream& operator<<(std::ostream& os, const libeosio::ec_privkey_t& k) {
std::ostream& operator<<(std::ostream& os, const libantelope::ec_privkey_t& k) {
return _hex(os, k.data(), k.size());
}
std::ostream& operator<<(std::ostream& os, const libeosio::ec_pubkey_t& k) {
std::ostream& operator<<(std::ostream& os, const libantelope::ec_pubkey_t& k) {
return _hex(os, k.data(), k.size());
}

View file

@ -23,10 +23,10 @@
*/
#include <secp256k1.h>
#include <secp256k1_ecdh.h>
#include <libeosio/ec.hpp>
#include <libantelope/ec.hpp>
#include "rng.h"
namespace libeosio {
namespace libantelope {
secp256k1_context* ctx;
@ -90,4 +90,4 @@ int ec_generate_key(struct ec_keypair *pair) {
return ec_get_publickey(&pair->secret, &pair->pub);
}
} // namespace libeosio
} // namespace libantelope

View file

@ -23,10 +23,10 @@
*/
#include <secp256k1.h>
#include <secp256k1_recovery.h>
#include <libeosio/ec.hpp>
#include <libantelope/ec.hpp>
#include "rng.h"
namespace libeosio {
namespace libantelope {
extern secp256k1_context* ctx;
@ -115,4 +115,4 @@ int ecdsa_recover(const sha256_t* digest, const ec_signature_t& sig, ec_pubkey_t
return len != EC_PUBKEY_SIZE ? -1 : 0;
}
} // namespace libeosio
} // namespace libantelope

View file

@ -24,10 +24,10 @@
#include <openssl/ec.h>
#include <openssl/bn.h>
#include <openssl/hmac.h>
#include <libeosio/ec.hpp>
#include <libantelope/ec.hpp>
#include "internal.h"
namespace libeosio {
namespace libantelope {
BN_CTX *ctx = NULL;
EC_KEY *k = NULL;
@ -121,4 +121,4 @@ int ec_generate_key(struct ec_keypair *pair) {
return 0;
}
} // namespace libeosio
} // namespace libantelope

View file

@ -24,10 +24,10 @@
#include <openssl/ec.h>
#include <openssl/bn.h>
#include <openssl/ecdsa.h>
#include <libeosio/ec.hpp>
#include <libantelope/ec.hpp>
#include "internal.h"
namespace libeosio {
namespace libantelope {
extern BN_CTX *ctx;
@ -182,4 +182,4 @@ err2: EC_KEY_free(ec_key);
err1: return ret;
}
} // namespace libeosio
} // namespace libantelope

View file

@ -23,9 +23,9 @@
*/
#include <openssl/sha.h>
#include <openssl/ripemd.h>
#include <libeosio/hash.hpp>
#include <libantelope/hash.hpp>
namespace libeosio {
namespace libantelope {
sha256_t* sha256(const unsigned char *data, std::size_t len, sha256_t* out) {
return (sha256_t *) SHA256(data, len, (unsigned char*) out);
@ -40,4 +40,4 @@ ripemd160_t* ripemd160(const unsigned char *data, std::size_t len, ripemd160_t*
return (ripemd160_t *) RIPEMD160(data, len, (unsigned char*) out);
}
} // namespace libeosio
} // namespace libantelope

View file

@ -24,8 +24,8 @@
#include <openssl/ec.h>
#include <openssl/hmac.h>
#ifndef LIBEOSIO_OPENSSL_INTERNAL_H
#define LIBEOSIO_OPENSSL_INTERNAL_H
#ifndef LIBANTELOPE_OPENSSL_INTERNAL_H
#define LIBANTELOPE_OPENSSL_INTERNAL_H
#define EC_KEY_new_secp256k1() (EC_KEY_new_by_curve_name( NID_secp256k1 ))
@ -62,4 +62,4 @@ int ECDSA_SIG_unserialize_rs(const unsigned char *sig, BIGNUM **r, BIGNUM **s, i
}
#endif
#endif /* LIBEOSIO_OPENSSL_INTERNAL_H */
#endif /* LIBANTELOPE_OPENSSL_INTERNAL_H */

View file

@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef LIBEOSIO_CODEC_H
#define LIBEOSIO_CODEC_H
#ifndef LIBANTELOPE_CODEC_H
#define LIBANTELOPE_CODEC_H
#include <libeosio/WIF.hpp>
#include <libantelope/WIF.hpp>
#include <vector>
namespace libeosio { namespace internal {
namespace libantelope { namespace internal {
/**
* Public-key encoders
@ -79,6 +79,6 @@ typedef bool (*sig_decoder_t)(const std::vector<unsigned char>& buf, ec_signatur
bool sig_decoder_k1(const std::vector<unsigned char>& buf, ec_signature_t& sig);
}} // namespace libeosio::internal
}} // namespace libantelope::internal
#endif /* LIBEOSIO_CODEC_H */
#endif /* LIBANTELOPE_CODEC_H */

View file

@ -22,11 +22,11 @@
* SOFTWARE.
*/
#include <libeosio/checksum.hpp>
#include <libantelope/checksum.hpp>
#include <vector>
#include "codec.hpp"
namespace libeosio { namespace internal {
namespace libantelope { namespace internal {
// Just to make it "harder" the calculated checksum for a signature (k1) and pub/priv keys in k1/r1 format.
// has a suffix that is not present in the WIF encoded string.
@ -125,4 +125,4 @@ bool sig_decoder_k1(const std::vector<unsigned char>& buf, ec_signature_t& sig)
}
}} // namespace libeosio::internal
}} // namespace libantelope::internal

View file

@ -22,10 +22,10 @@
* SOFTWARE.
*/
#include <libeosio/checksum.hpp>
#include <libantelope/checksum.hpp>
#include "codec.hpp"
namespace libeosio { namespace internal {
namespace libantelope { namespace internal {
#define PRIV_KEY_PREFIX 0x80 /* 0x80 for "Bitcoin mainnet". Always used by EOS. */
@ -77,4 +77,4 @@ bool priv_decoder_legacy(const std::vector<unsigned char>& buf, ec_privkey_t& pr
return true;
}
}} // namespace libeosio::internal
}} // namespace libantelope::internal