Skip to content

Instantly share code, notes, and snippets.

View sleepdefic1t's full-sized avatar

₴Ⱡ33₱ sleepdefic1t

View GitHub Profile
APDU Header description
CLA Instruction Class
INS Instruction
P1 More/Last Payload
P2 Signing Algorithm
INS byte
GetPublicKey 0x02
@sleepdefic1t
sleepdefic1t / schnorr_bcrypto_410.c
Created February 4, 2020 23:11
ARK Core v.2.6 / BCrypto v.4.1.0 / BCH Schnorr Implementation for the Ledger Nano SDK
/*******************************************************************************
* This file is part of the ARK Ledger App.
*
* Copyright (c) ARK Ecosystem <[email protected]>
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
/*******************************************************************************
*
* Copyright (c) Simon Downey <[email protected]>
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
/*******************************************************************************
*
* Copyright (c) Simon Downey <[email protected]>
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
@sleepdefic1t
sleepdefic1t / endian.h
Created January 14, 2020 16:55
Detect Platform Endianness in C
#ifndef ENDIAN_H
#define ENDIAN_H
#include <stdint.h>
int isBigEndian() {
union {
uint32_t i;
char c[4];
@sleepdefic1t
sleepdefic1t / print_int64_to_float.hpp
Last active January 13, 2020 21:20
Print Int64's as Floats (long doubles)
/*******************************************************************************
* This file is part of the ARK Ecosystem.
*
* Copyright (c) ARK Ecosystem <[email protected]>
* Copyright (c) Simon Downey <[email protected]> (https://github.com/sleepdefic1t)
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@sleepdefic1t
sleepdefic1t / src-CMakeFiles.txt
Created November 29, 2019 23:18
Radians C++ Scooter Registration Implementation
cmake_minimum_required(VERSION 3.2)
project(ark_cpp_crypto C CXX)
# ------------------------------------------------------------------------------
# External Libraries
# ------------------------------------------------------------------------------
include(${CMAKE_SOURCE_DIR}/cmake/External.cmake)
@sleepdefic1t
sleepdefic1t / base58.cpp
Created November 18, 2019 22:21
C++ Base58 - Basic Impl
std::vector<uint8_t> decodeBase58(const uint8_t *in, const size_t length) {
unsigned char const BASE58TABLE[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,

Reset a Forked Repo's Master to Upstream

# ensures current branch is master
git checkout master

# pulls all new commits made to upstream/master
git pull upstream master

# this will delete all your local changes to master
#
#
# Downloads GTest and provides a helper macro to add tests. Add make check, as well, which
# gives output on failed tests without having to set an environment variable.
#
#
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
if(CMAKE_VERSION VERSION_LESS 3.11)
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")