Skip to content

Instantly share code, notes, and snippets.

int2ff(n, g) = { subst(Pol(digits(n, g.p)), 'x, g) };
ff2int(x) = { subst(x.pol, variable(x.pol), x.p) };
digits2int(v, b) = { subst(Pol(v), 'x, b) };
binary2int(v) = { digits2int(v, 2) };
bitreverse(x, n) = { binary2int(Vecrev(binary(x), -n)) };
z = 0;
p = ffgen(Pol(digits(5064959490650433080525841, 2)) * Mod(1,2));
m = [48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48 ];
import subprocess
import struct
import binascii
import random
remote = True
if remote:
cmd = "nc bigpicture.chal.pwning.xxx 420"
else:
cmd = "./bigpicture"
a = vector(5);
b = vector(5);
c = vector(5);
n = vector(5);
a[1] = 69083553146183344839772978505267712546348345951915552104934666999364893606414967631473531356169090286677897220956536147203986323670778671853966574104550916190831974039291113434428713226539656233005536401237618731903013444912424490954403050283261443145833828774338405850464149745370010921929208582803372719662;
b[1] = 1847353606880715823527099792264841437499256859046112182901817731898583109812226034453486290034759426343181112477498401843027934563915568068662901070357638240406212287869791959600724393823543974271939728800168160170264361943043888105413027223078955278440961637038127459036967868261370295558665462738851664674;
c[1] = 13924397671629169794872532654354896735104301636897981275021597449713744312702850679542667853889775700566291452624971794825605462609659305736119167763171202028684488729179106128850062049316631850373987498751231054904292395688010798166991604433834113228237987911867991301264314792383410544657232986272138720776;
n[1] = 1071766
import subprocess
import struct
import time
from secret import TOKEN
remote = True
if remote:
cmd = 'nc 202.112.51.247 3456'
else:
// read from fildes til read "size" bytes or read "split" byte
read_until(int fildes, char* buf, int size, int split);
read_name(struct gun *gun) {
puts("Length of name...");
int n = read_int();
char* buf = malloc(n+1);
assert(buf != NULL);
puts("Input name:");
read_until( stdin, buf, n, '\n');
def str2num(s):
return int(s.encode('hex'), 16)
def num2str(n, block=16):
s = hex(n)[2:].strip('L')
s = '0' * ((32-len(s)) % 32) + s
return s.decode('hex')
P = 0x100000000000000000000000000000087
g = ffgen((x^128 + x^7 + x^2 + x + 1)* Mod(1,2), 'x);
int2ff(n, g) = { subst(Pol(digits(n, g.p)), 'x, g) };
ff2int(x) = { subst(x.pol, variable(x.pol), x.p) };
A = 264046295839861049478585915471640894461
B = 61271402786193883928865590532021375813
c0 = 18157014022896961033533781555789031836
c1 = 260901311726713247284389786686953430464
g = ffgen((x^256 + x^10 + x^5 + x^2 + 1)* Mod(1,2), 'x);
int2ff(n, g) = { subst(Pol(digits(n, g.p)), 'x, g) };
ff2int(x) = { subst(x.pol, variable(x.pol), x.p) };
c1=79267468907649481004031669197619294997861358148687669164280161107568250560639
c2=44804956138029594877678183404451458957271575260252646638476893887508109415484
c3=105423975506774012983169132796348436324065606442637215942997207372385819512091
m2=33187360835812316451114895390418536388082057316848544621384752934291486240101
m3=46315061891984415653414698371505035098503951411565883566135560804212672652901
import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Control.DeepSeq
import Data.Time
import Control.Exception(evaluate)
import System.IO
import Control.Applicative
import Text.Printf
import Prelude hiding(log)
import qualified VecSort as Vec
{-# LANGUAGE BangPatterns #-}
module VecSort(sort, sortBy) where
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as MV
{-# INLINE sort #-}
sort :: Ord a => [a] -> [a]
sort = sortBy compare
sortBy :: (a -> a -> Ordering) -> [a] -> [a]