Skip to content

Instantly share code, notes, and snippets.

@martani
martani / afterSignHook.ts
Created May 25, 2019 03:12
electron-builder after sign hook to notarize Mac OS apps using electron-notarize
// See: https://medium.com/@TwitterArchiveEraser/notarize-electron-apps-7a5f988406db
const fs = require('fs');
const path = require('path');
var electron_notarize = require('electron-notarize');
module.exports = async function (params) {
// Only notarize the app on Mac OS only.
if (process.platform !== 'darwin') {
return;

Keybase proof

I hereby claim:

  • I am martani on github.
  • I am martani (https://keybase.io/martani) on keybase.
  • I have a public key whose fingerprint is 44CE 0F6C 84E2 CA9C 0B0B 643E E05E 0DD5 E21E 38D5

To claim this, I am signing this object:

//Append this function to class Indexer.
template <typename Matrix>
void spliceToAB(Matrix& M, Matrix& A, Matrix& B)
{
typename Matrix::Row::const_iterator it;
// Splice M into two submatrices A and B, A contains pivot columns, B contains non pivot colums.
uint32 curr_piv = 0;
@martani
martani / gist:4471399
Last active December 10, 2015 17:58
Online padding oracle
//Class implements ICBCOracle
public class OnlineCBCOracle : ICBCOracle
{
public bool RequestOracle(byte[] cipher)
{
const string BASE_URL = "ORACLE_URL?er=";
string urlData = Helpers.ConvertByteArrayToHexString(cipher);
WebClient wc = new WebClient();
try
@martani
martani / gist:4471394
Created January 7, 2013 00:44
padding oracle attacker
//The Oracle
ICBCOracle cbcOracle = new Oracles.OnlineCBCOracle();
//The attacker, passing the Oracle to constructor
PaddingOracleAttacker attacker = new PaddingOracleAttacker(cbcOracle);
//Prepare the ciphertext
string cipherHex = "f20bdba6ff29eed7b046d1df9fb7000058b1ffb4210a580f748";
byte[] cipher = Helpers.ConvertHexStringToByteArray(cipherHex);
@martani
martani / AES_Decrypt_block.cs
Created September 23, 2012 22:53
AES single block decryption/encryption _
private static byte[] AES_Decrypt_block(byte[] cipherText, byte[] Key)
{
// Declare the string used to hold the decrypted text.
byte[] output_buffer = new byte[cipherText.Length];
using (AesManaged aesAlg = new AesManaged())
{
//If CBC, must initialize IV = O_{128}
//aesAlg.Mode = CipherMode.CBC;
//aesAlg.IV = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@martani
martani / AES_Decrypt_block
Created September 23, 2012 16:03
AES single block decryption/encryption
private static byte[] AES_Decrypt_block(byte[] cipherText, byte[] Key)
{
// Declare the string used to hold the decrypted text.
byte[] output_buffer = new byte[cipherText.Length];
using (AesManaged aesAlg = new AesManaged())
{
//If CBC, must initialize IV = O_{128}
//aesAlg.Mode = CipherMode.CBC;
//aesAlg.IV = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@martani
martani / qs.sh
Created February 8, 2012 23:27
Distributed Quadratic Sieve running time
<<intel i7 for all tests>>
N = 676292275716558246502605230897191366469551764092181362779759 (60 digits | 199 bits)
Time = 16.76 minutes (~ 17 hours on centralized version)
N = 1522666296953962938975648266957818297826962898780435311 (55 digits | 180 bits)
Time = 7.178 minutes
N = 5705979550618670446308578858542675373983 (40 digits | 133 bis)
Time = 5 seconds
@martani
martani / qs_cent.sh
Created February 8, 2012 23:22
Quadratic Sieve running time
<<intel i7>>
N = 676292275716558246502605230897191366469551764092181362779759 (60 digits | 199 bits)
Time = ~17 hours
<<intel i3>>
N = 139920333957092418127239064840267210440539 (42 digits | 137 bits)
Time = 66 minutes
<<intel i7>>
N = 5705979550618670446308578858542675373983 (40 digits | 133 bits)
@martani
martani / gist:1503951
Created December 21, 2011 00:30
Pollard's rho factoring method execution time
$ ./pollard-rho 18446744073709551617
Factoring 18446744073709551617 ..
Testing GCD: 274177
Found divisor g = 274177 in 901 steps [0.004 s]
$ ./pollard-rho 10023859281455311421
Factoring 10023859281455311421 ..
Testing GCD: 1308520867
Found divisor g = 1308520867 in 25601 steps [0.037 s]