Skip to content

Instantly share code, notes, and snippets.

@daira
daira / addchain_5inv_rtlv2.py
Created Mar 19, 2021
rtl addition chain v2
View addchain_5inv_rtlv2.py
# ---> up to here is a multiple of 0b110011 = 51 :-)
x_p = 0b11001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001101001110100111101110000011001001101000010000101001100000111000101110000011110000111100111111000011001100110011001100110011001101
pchain = Chain()
pi = pa = 1
for i in range(1, 128):
pi = pchain.sqr(pi)
if '01001110100111101110000011001001101000010000101001100000111000101110000011110000111100111111000011001100110011001100110011001101'[127-i] == '1':
pa = pchain.mul(pa, pi)
View addchain_5inv_rtl.py
# ---> up to here is a multiple of 3 :-)
x_p = 0b11001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001101001110100111101110000011001001101000010000101001100000111000101110000011110000111100111111000011001100110011001100110011001101
pchain = Chain()
pi = pa = 1
for i in range(1, 114):
pi = pchain.sqr(pi)
if '101110000011001001101000010000101001100000111000101110000011110000111100111111000011001100110011001100110011001101'[113-i] == '1':
pa = pchain.mul(pa, pi)
View keybase.md

Keybase proof

I hereby claim:

  • I am daira on github.
  • I am zedaira (https://keybase.io/zedaira) on keybase.
  • I have a public key ASDhxWkEakEA-bzyc2LulixNHnPD83MdWX4Q4cGxlezvRwo

To claim this, I am signing this object:

View Fully shielded transactions
SELECT alltxs.block_timestamp_month, fulltxs.fully_shielded_count, 100*fulltxs.fully_shielded_count/alltxs.count AS fully_shielded_percent FROM
(SELECT
block_timestamp_month, count(distinct `hash`) AS fully_shielded_count
FROM
`bigquery-public-data.crypto_zcash.transactions` AS zec_txs
WHERE
NOT EXISTS (SELECT 1 FROM UNNEST(zec_txs.inputs) WHERE NOT type = 'shielded')
AND NOT EXISTS (SELECT 1 FROM UNNEST(zec_txs.outputs) WHERE NOT type = 'shielded')
GROUP BY block_timestamp_month) fulltxs
INNER JOIN
View smallprp.py
# https://eprint.iacr.org/2012/254
def random(K):
ctr = 0
while True:
yield AES(K, ctr)
ctr += 1
def PRP(K, x):
return (x, 0, N, 0, random(K))
@daira
daira / gist:3300082
Created Aug 9, 2012
ExpirationPolicy
View gist:3300082
class ExpirationPolicy(object):
def __init__(self, enabled=False, mode="age", override_lease_duration=None,
cutoff_date=None, sharetypes=("mutable", "immutable")):
precondition(isinstance(enabled, bool), enabled=enabled)
precondition(mode in ("age", "cutoff-date"), mode=mode)
precondition(isinstance(override_lease_duration, (int, NoneType)),
override_lease_duration=override_lease_duration)
precondition(isinstance(cutoff_date, int) or (mode != "cutoff-date" and cutoff_date is None),
cutoff_date=cutoff_date)
precondition(isinstance(sharetypes, tuple), sharetypes=sharetypes)
@daira
daira / gist:3290388
Created Aug 7, 2012
excerpt from #leastauthorityenterprises on freenode
View gist:3290388
(18:37:09) amiller: zooko, i'd like to chat about lae sometime soon
(18:39:45) zooko: amiller: Hi! Oh, I'd love that. What mode of chat do you prefer?
(18:39:52) amiller: irc!
(18:39:54) zooko: When's the next time you're coming to visit Boulder? :-)
(18:40:00) amiller: sometime!
(18:40:02) zooko: Okay, anytime!
(18:40:05) amiller: how bout now
(18:40:06) zooko: I mean, okay anytime about IRC chat.
(18:40:09) zooko: Okay.
(18:40:38) amiller: i figured out / remembered how to use flogtool again