Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 2 columns, instead of 1. in line 5.
EC ScalarMul 255-bit G1 (vartime reference DoubleAdd) ; ECP_ShortW_Jac[Fp[BLS12_381], G1] ; 10939.722 ops/s; 91410 ns/op; 301080 CPU cycles (approx)
EC ScalarMul 255-bit G1 (vartime wNAF-3) ; ECP_ShortW_Jac[Fp[BLS12_381], G1] ; 13986.601 ops/s; 71497 ns/op; 235493 CPU cycles (approx)
EC ScalarMul 255-bit G1 (vartime wNAF-4) ; ECP_ShortW_Jac[Fp[BLS12_381], G1] ; 14373.599 ops/s; 69572 ns/op; 229152 CPU cycles (approx)
EC ScalarMul 255-bit G1 (vartime wNAF-5) ; ECP_ShortW_Jac[Fp[BLS12_381], G1] ; 14523.484 ops/s; 68854 ns/op; 226787 CPU cycles (approx)
EC ScalarMul 255-bit G1 (vartime endomorphism + wNAF-3) ; ECP_ShortW_Jac[Fp[BLS12_381], G1] ; 21272.975 ops/s; 47008 ns/op; 154834 CPU cycles (approx)
EC ScalarMul 255-bit G1 (vartime endomorphism + wNAF-4) ; ECP_ShortW_Jac
@mratsim
mratsim / android-backup-apk-and-datas.md
Created September 23, 2023 21:25 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

Fetch application APK

@mratsim
mratsim / trusted_setups.md
Last active May 16, 2023 21:30
A data serialization format for trusted setups for zero-knowledge cryptography
@mratsim
mratsim / macro_assembler_x86.nim
Created April 21, 2023 14:55
Compile-Time x86 ASM Assembler
# Constantine
# Copyright (c) 2018-2019 Status Research & Development GmbH
# Copyright (c) 2020-Present Mamy André-Ratsimbazafy
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import std/[macros, strutils, sets, hashes, algorithm]
# Constantine
# Copyright (c) 2018-2019 Status Research & Development GmbH
# Copyright (c) 2020-Present Mamy André-Ratsimbazafy
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
# TODO: while there is likely no attacks available that may exploit
# how work is stolen from threads by other threads,
@mratsim
mratsim / c_openarray.nim
Created January 7, 2023 15:31
Dealing with push/pop and C openarray wrapper
# Constantine
# Copyright (c) 2018-2019 Status Research & Development GmbH
# Copyright (c) 2020-Present Mamy André-Ratsimbazafy
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import std/macros
@mratsim
mratsim / bench_gmp_mul.nim
Created January 3, 2023 12:59
Constantine vs GMP on mul
# Constantine
# Copyright (c) 2018-2019 Status Research & Development GmbH
# Copyright (c) 2020-Present Mamy André-Ratsimbazafy
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
# This file should be put in a ./build subfolder of the constantine repo
# Compile with: nim c -r -d:danger build/bench_gmp_mul.nim
@mratsim
mratsim / mad.cu
Created December 17, 2022 09:33
Cuda 11.5 or lower muladd-carry bug
# https://forums.developer.nvidia.com/t/wrong-result-returned-by-madc-hi-u64-ptx-instruction-for-specific-operands/196094
# https://github.com/tickinbuaa/CudaTest
#include <cuda_runtime.h>
#include <memory>
__device__
inline void mac_with_carry(uint64_t &lo, uint64_t &hi, const uint64_t &a, const uint64_t &b, const uint64_t &c) {
if (blockIdx.x == 0 && threadIdx.x == 0) {
printf("GPU calculation input: a = %lx b = %lx c = %lx\n", a, b, c);