Week 0x9 I
Crypto
genrsa
and linker
VoDs, which will help you if you get stuck on the final, but right now I could only do them poorly, rather than well.BTCinC
and the readings.An anti-pattern in software engineering, project management, and business processes is a common response to a recurring problem that is usually ineffective and risks being highly counterproductive.
word
.
$ time python3 rtlkon.py testbench.vcd >/dev/null
real 0m0.323s
user 0m0.285s
sys 0m0.030s
$ time java daikon.Daikon testbench.decls testbench.dtrace >/dev/null
real 0m4.358s
user 0m14.128s
sys 0m0.413s
$ wc testbench.decls testbench.dtrace
2219 4434 39059 testbench.decls
2936134 2931732 17474090 testbench.dtrace
2938353 2936166 17513149 total
Bijective |
Injective |
Surjective |
Neither |
[A-Za-z0-9+/]
[A-Za-z0-9+/]
uint64_t bigdiv(uint64_t *num, uint64_t *den, uint64_t *quo, uint64_t *rem) {
uint64_t i = getmsb(num), j = getmsb(den), n, d, tmq[S], tmr[S];
(4 + 2) * 64 * 64 = 24576
= 25 kilobytes for 5/2
bigkey
and bigrsa
void seebig(uint64_t *a);
uint64_t bigadd(uint64_t *in0, uint64_t *in1, uint64_t *sum);
uint64_t bigsub(uint64_t *min, uint64_t *sub, uint64_t *dif);
uint64_t bigmul(uint64_t *in0, uint64_t *in1, uint64_t *out);
uint64_t bigdiv(uint64_t *num, uint64_t *den, uint64_t *quo, uint64_t *rem);
uint64_t bigquo(uint64_t *num, uint64_t *den, uint64_t *quo);
uint64_t bigrem(uint64_t *num, uint64_t *den, uint64_t *rem);
bignul
at the point-of-us, in both bigrsa
and bigkey
bignul
back into 4096_t.h
FILE *fp = fopen("file.txt", "r");
uint32_t word, conditional;
do {
fread(word, 4, 1, fp);
print_in_base85(word);
} while ( conditional );
conditional
?FILE *fp = fopen("file.txt", "r");
uint32_t word;
size_t cond;
do {
fread(word, 4, 1, fp);
cond = print_in_base85(word);
} while ( 4 == cond );
biggmp.c
, a libgmp implementation of 4096_t I am now providing for usage on bigrsa
, could contain much repeated code.mpz_t
variable.mpz_init
mpz_import
mpz_export
mpz_clear
or slowing using up all your memory.sum
is used unitialized
void bigsub(uint64_t *in0, uint64_t *in1, uint64_t *dif) {
mpz_t m0, m1;
memset(dif, 0, BYTES);
mpz_inits(m0, m1, NULL);
mpz_import(m0, S, -1, sizeof(uint64_t), 0, 0, a);
mpz_import(m1, S, -1, sizeof(uint64_t), 0, 0, b);
mpz_sub(m0,m0,m1);
mpz_export(c, NULL, -1, sizeof(uint64_t), 0, 0, m0);
mpz_clears(m0, m1, NULL);
}
void bigadd(uint64_t *in0, uint64_t *in1, uint64_t *sum) {
mpz_t m0, m1;
memset(sum, 0, BYTES);
mpz_inits(m0, m1, NULL);
mpz_import(m0, S, -1, sizeof(uint64_t), 0, 0, a);
mpz_import(m1, S, -1, sizeof(uint64_t), 0, 0, b);
mpz_add(m0,m0,m1);
mpz_export(c, NULL, -1, sizeof(uint64_t), 0, 0, m0);
mpz_clears(m0, m1, NULL);
}
void apply(uint64_t *in0, uint64_t *in1, uint64_t *out, function) {
mpz_t m0, m1;
memset(sum, 0, BYTES);
mpz_inits(m0, m1, NULL);
mpz_import(m0, S, -1, sizeof(uint64_t), 0, 0, a);
mpz_import(m1, S, -1, sizeof(uint64_t), 0, 0, b);
function(m0,m0,m1);
mpz_export(c, NULL, -1, sizeof(uint64_t), 0, 0, m0);
mpz_clears(m0, m1, NULL);
}
uint64_t bigadd(uint64_t *in0, uint64_t *in1, uint64_t *sum) {
apply(in0, in1, sum, mpz_add);
return 0;
}
uint64_t bigsub(uint64_t *min, uint64_t *sub, uint64_t *dif) {
apply(min, sub, dif, mpz_sub);
return 0;
}
uint64_t bigmul(uint64_t *in0, uint64_t *in1, uint64_t *out) {
apply(in0, in1, out, mpz_mul);
return 0;
}
mpz_add
returns void and accepts 3 mpz_t
arguments.
const
which is out-of-scope for now???_t
and then just using different header files with different S
values.uint32.c
#include <stdio.h>
#include <stdio.h>
void show(char *buf) {
int *alias = (int *)buf;
printf("%%s -> %s\n", buf);
printf("%%d -> %d\n", (int)*alias);
printf("%%u -> %u\n", (unsigned)*alias);
printf("%%x -> %x\n", (unsigned)*alias);
printf("As array: [%d, %d, %d, %d]\n", buf[0], buf[1], buf[2], buf[3]);
printf("As array: [%x, %x, %x, %x]\n", buf[0], buf[1], buf[2], buf[3]);
}
void main() {
char buf[4] = "hi!";
int *alias = (int *)buf;
printf("\n\"hi!\" n ways:\n");
show(buf)
printf("\nadd 10 to *alias\n");
*alias += 10;
show(buf);
}
6650210
mean?Macros
) starts to look an awful lot like a LISP implementation in more sophisticated projects.CAT
meansmpz_init
callsstruct
malloc