Skip to content

Instantly share code, notes, and snippets.

Gamma Ray

Scheme

According to the code, the secret $s$ is an element of the prime field MNT4BigFr (753 bits):

#[derive(MontConfig)]
#[modulus = "41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888458477323173057491593855069696241854796396165721416325350064441470418137846398469611935719059908164220784476160001"]
#[generator = "17"]
#[small_subgroup_base = "5"]
@sylvainpelissier
sylvainpelissier / rsa_factor.py
Last active August 18, 2023 20:07 — forked from AntonKueltz/rsa_factor.py
Factor an RSA modulus given the public and private key
def factor(n, e, d):
"""http://crypto.stackexchange.com/a/25910/17884
Requires gmpy2
n - modulus
e - public exponent
d - private exponent
returns - (p, q) such that n = p*q
"""
from gmpy2 import gcd
@sylvainpelissier
sylvainpelissier / sm4_riscv_faults
Created November 4, 2022 15:02
SM4 RISC-V hardware faults
bf4df6296cbdfcdd6c93247e7fcbfb9a
bf4df6296cbdfcdd6c93247e7fcbfb9e
bf4df6296cbdfcdd6c93247e7f5bffde
bf4df6296cbdfcdd6c93247e7f5befde
bf4df629fe7dfedd6c93247e7fcbfb9a
bf4df629fefdfedd6c93247e7fcbfb9a
bf4df6297efdfedd6c93247e7fcbfb9a
bf4df629bf4df6296c93247e7fcbfb9a
bf4df6296cbdfcdd6cbdfcdd7fcbfb9a
bf4cb4296cbdfcdd6c93247e7fcbfb9a
@sylvainpelissier
sylvainpelissier / sm4_arm_emulated_faults
Created November 4, 2022 14:01
SM4 ARM firmware emulated faults
fc5487924a033411275beb17ce749e3e
fe19ae3c3ba12c956e9743797ad033a1
f33ef9b897cfc6adfb10d267606ee544
a62236b08fa5607a01b5282af0c34747
f33ef9b897cfc6adfb10d267606ee544
97928c90afab47eb6f3e5af6468cc06c
c19e81900fc0ac3e57faa1a489f131e6
7ae58598618a585baac4a13e85c4582e
3d5810f52c4f9464ad59f7833dde89c3
f5b3d8876904b3eacb42b98dec61d4db
@sylvainpelissier
sylvainpelissier / sm4_faults_last_round
Last active June 5, 2024 03:58
SM4 DFA last round
1ba45679bea5d707acc812cb2d997928
46d52755bea5d707acc812002d997928
7301f3b4bea5d707acc812cb2d997954
cbeb19e6bea5d74facc812cb2d997928
2b985a49bea5d707acc812cb2d297928
6751a3f0bea5d707acc812cb2d99793d
1ba45689bea5d707acc812cb2d997928
88a45679bea5d707acc812cb2d997928
df32042bbea5d7078ec812cb2d997928
1ba456d7bea5d707acc812cb2d997928
@sylvainpelissier
sylvainpelissier / ecryptfs-setup.sh
Last active January 11, 2022 18:18
eCryptFS Setup on Manjaro
#!/bin/bash
echo " eCryptFS Installation Script for Manjaro Linux "
echo " ---------------------------------------------- "
echo " This script will download and install the packages required to run eCryptFS and its utilities to encrypt a users home directory."
if [[ $EUID -ne 0 ]]; then
echo ""
echo " !! This script must be run as root !!"
echo " !! Exiting. !!"
echo ""
@sylvainpelissier
sylvainpelissier / i2c-dump.py
Last active September 22, 2017 11:45 — forked from cutaway/i2c-dump.py
Script to interact with I2C EEPROM memory components using the BusPirate via pyBusPirateLite
#!/usr/bin/env python
# encoding: utf-8
"""
Adapted from i2c-test.py from Peter Huewe by Jean-Michel Picod
Modified by Don C. Weber (cutaway) and InGuardians, Inc. 20141015
i2c-dump is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@sylvainpelissier
sylvainpelissier / pyuac.py
Last active March 20, 2023 23:28 — forked from Preston-Landers/pyuac.py
pyuac - elevate a Python process with UAC on Windows compatible Python 3.
#!/usr/bin/env python
# -*- coding: utf-8; mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vim: fileencoding=utf-8 tabstop=4 expandtab shiftwidth=4
"""User Access Control for Microsoft Windows Vista and higher. This is
only for the Windows platform.
This will relaunch either the current script - with all the same command
line parameters - or else you can provide a different script/program to
run. If the current user doesn't normally have admin rights, he'll be