Skip to content

Instantly share code, notes, and snippets.

proc c_sprintf(buf, frmt: cstring):int {.header: "<stdio.h>",
importc: "sprintf", varargs, noSideEffect.}
proc to_s(f: float): string =
var buf: array [0..64, char]
var n:int = c_sprintf(buf, "%.16g", f)
for i in 0..n:
if buf[i] == '.': return $buf
buf[n] = '.'
buf[n+1] = '0'
buf[n+2] = '\0'
+-- RxM -----------------+
| Laptop |
| /|\ |
| RxAVR<-TRNG |
| +----< OC <---ADAVR <--SID<--[ untrusted pc ] (browser?)
+------------------------+ /|\
|
+-- TxM --------------------+ |
| PS2 keyboard + power | |
| \|/ | |
12:03 < FROGGS> hi everybody, is this channel logged?
13:12 < katlogic> Only past 2 days
13:14 < FROGGS> hmmm, does Mike Pall pop in from time to time?
13:15 < katlogic> last time i've seen him on irc was like 2011
13:15 < FROGGS> I am asking because we'd need some clarification that might work best on irc
13:15 < FROGGS> ohh, hehe
13:15 < FROGGS> okay, mailing list is fine then :o)
13:15 < katlogic> FROGGS: well, feel free to ask here
13:16 < FROGGS> it is about this: http://www.freelists.org/post/luajit/runtime-variable-register-in-dynasm,2
13:16 < katlogic> You want dynasm to patch in dynamic registers
#define DEF_ERR(_) \
_(EPERM)_(ENOENT)_(ESRCH)_(EINTR)_(EIO)_(ENXIO)_(E2BIG)_(ENOEXEC) \
_(EBADF)_(ECHILD)_(EAGAIN)_(ENOMEM)_(EACCESS)_(EFAULT)_(ENOTBLK) \
_(EBUSY)_(EEXIST)_(EXDEV)_(ENODEV)_(ENOTDIR)_(EISDIR)_(EINVAL) \
_(ENFILE)_(EMFILE)_(ENOTTY)_(ETXTBSY)_(EFBIG)_(ENOSPC)_(ESPIPE) \
_(EROFS)_(EMLINK)_(EPIPE)_(EDOM)_(ENAMETOOLONG)_(ENOSYS)_(ELOOP) \
_(EAGAIN)
#define DEF_SYMS(_) \
_(SEEK_SET)_(SEEK_CUR)_(SEEK_END) \
#include <stdio.h>
#include <new>
void * operator new(unsigned long n)
{
return 0;
}
class Test {
public:;
int _x;
Test(int x) {
local lmath = require 'gmp'
local print, setmetatable, io, string, math, assert, pairs
= print, setmetatable, io, string, math, assert, pairs
local bn = lmath.z
local rsa = {}
local rsa_mt = {__index=rsa}
local genmod = 65537
do local _ENV = rsa
---------------------------------------
local s,m,t,sm = string,math,table,setmetatable
local mt = {} -- holds initial vector too
local S = {} -- S-box
-- As per FIPS 180-4
local conv = function(i)
return s.format("%.0f", m.floor(2^32*select(2,m.modf(i))))>>0
end
for i=2,311 do
for _,v in ipairs {2,3,5,7,11,13,17} do
#define RSA_BITS 2048
#define RSA_BYTES (RSA_BITS/8)
#define DIGIT uint32_t
#define DIGIT_BITS (sizeof(DIGIT)*8)
#define DIGIT_MAX ((DIGIT)(-1))
#define NDIGITS (RSA_BITS/DIGIT_BITS)
static int b_add(DIGIT * restrict r, DIGIT * restrict x, DIGIT * restrict y)
{
#include <stdint.h>
#include <sys/mman.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
static struct chunk {
struct chunk *next;
uint32_t base;
uint32_t len;
int main(int argc, char **argv)
{
char *p;
for (p = argv[0]; *p; p++) {
puts(p); p += strlen(p);
}
}