This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<<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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Dictionary<char, double> AnalyseFrequency(string text) | |
{ | |
if (text == null) | |
return null; | |
Dictionary<char, double> frequencies = new Dictionary<char, double>(); | |
int textLength = text.Length; | |
for (int i = 0; i < textLength; i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void nsleep(long us) | |
{ | |
struct timespec wait; | |
//printf("Will sleep for is %ld\n", diff); //This will take extra ~70 microseconds | |
wait.tv_sec = us / (1000 * 1000); | |
wait.tv_nsec = (us % (1000 * 1000)) * 1000; | |
nanosleep(&wait, NULL); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MARTANI Fakhrou 2011 | |
//Vigenere Decoder | |
//http://martani.net | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace codebook |
OlderNewer