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
#include <iostream> | |
#include <gmpxx.h> | |
#include <cstdint> | |
#include <chrono> | |
#include <vector> | |
#include <stdlib.h> | |
#define PREC 64*4 | |
#define PREC_LIMB_SIZE 4 |
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
import timeit | |
import numpy as np | |
from mypower import mypower | |
def fff(array, d): | |
y2 = array**d # this calls np.power | |
return y2 | |
def ggg(array, d): | |
y2 = np.power(array, d) |
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
import timeit | |
import numpy as np | |
def mypower(y): | |
y2 = y*y | |
y3 = y*y2 | |
y4 = y2*y2 | |
y5 = y2*y3 | |
y6 = y3*y3 | |
return y2, y3, y4, y5, y6 |
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
#include <iostream> | |
#include <time.h> | |
#include <gmpxx.h> | |
#define SIZE 9 | |
static inline void mod(mp_limb_t *z, const mp_limb_t *XY, const mp_limb_t *p, mp_limb_t *t, mp_limb_t *s) { | |
// (T + (T mod R)*N) / R |
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
#include <iostream> | |
#include <time.h> | |
#include <gmpxx.h> | |
#define SIZE 9 | |
void mod2(mp_limb_t *z, const mp_limb_t *XY, const mp_limb_t *p, mp_limb_t *q) { | |
mpn_tdiv_qr(q, z, 0, (const mp_limb_t *)XY, SIZE*2, (const mp_limb_t*)p, SIZE); | |
} |
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
#include<iostream> | |
#include<gmpxx.h> | |
#include <time.h> | |
static const int N = 100000; | |
static void set_mpz_t(mpz_t& z, const uint64_t* p, int n) { | |
int s = n; | |
while (s > 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
#include<iostream> | |
#include<gmpxx.h> | |
#include <time.h> | |
static const int N = 100000; | |
static void set_mpz_t(mpz_t& z, const uint64_t* p, int n) { | |
int s = n; | |
while (s > 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
package main | |
import ( | |
"fmt" | |
"os" | |
"hash" | |
"strings" | |
"crypto/MD5" | |
"crypto/SHA1" | |
"crypto/SHA256" |
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
#include<stdio.h> | |
void num_to_bytes(unsigned long long num, unsigned char bytes[]) { | |
for(int i = 0; i < 4; i++) { | |
bytes[i] = (num >> (i*8)) & 0xFF; | |
} | |
} | |
unsigned long long bytes_to_num(unsigned char bytes[]) { | |
unsigned long long num = 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
package main | |
import ( | |
"fmt" | |
. "./ecUtils" | |
. "./mathUtils" | |
) | |
// https://github.com/ykm11/goCurve | |
NewerOlder