Skip to content

Instantly share code, notes, and snippets.

View lengyijun's full-sized avatar
🦄

lyj lengyijun

🦄
  • SJTU
  • China Shanghai
View GitHub Profile
%{
#include<stdio.h>
#include<ctype.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
%}
@lengyijun
lengyijun / c.l
Created October 26, 2017 08:26
实现#
%{
#include<stdio.h>
#include<ctype.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
%}

zksnark的第一步就是由几个随机数作key generation ,在区块链中,显然不会有第三方来提供key generation。好在BCTV2015的结果保证可以使用相同的proving key和verification key。 prover允许知道verification key,verifier也允许知道proving key,但是prover和verifier都不允许知道用来生成key的随机数。我们要求这些随机数被丢弃掉(toxic waste),甚至希望这些随机数从未出现在内存中过。 zcash开发者采用MPC(安全多方计算)来实现,想法是6个参与者每个人提供一个随机数,把随机数乘在一起得到最终的随机数。具体细节见pdf[https://github.com/zcash/mpc/blob/master/whitepaper.pdf] 于是在2016年10月23日,6名开发者在不同位置,使用新电脑完成了这次计算。每个人有两台电脑,一台用来计算而不联网,一台联网而不计算。两者之间通过disc来传输。所有视频、音频和文字材料都公开了。

还有几个有用的链接:zcash中变量的关系图[https://z.cash/downloads/visualization.pdf],对理解snark和zcash交易细节有帮助

clear;
q:=19;
Fq:=GF(q);
Fq2<i>:=ExtensionField<Fq,x|x^2+1>;
Fq3<i>:=ExtensionField<Fq,x|x^3+3>;
a:=0;
b:=4;
E:=EllipticCurve([Fq|a,b]);
E2:=EllipticCurve([Fq2|a,b]);
  1. Install juice-shop; if you are using docker,you may type sudo docker pull registry.docker-cn.com/bkimminich/juice-shop to download image faster; remember follow the official instrucion to install docker
  2. Install burpsuite Pro you may have two file downloaded:["BurpLoader.jar","burpsuite_pro_v1.7.11.jar"];java -jar BurpLoader.jar or append alias burpsuite="java -jar PATHTO/BurpLoader.jar" to .zshrc/.bashrc,source .zshrc
  3. Set proxy to Firefox remember to clear "No proxy for" to avoid missing package of 'localhost:3000'
  4. follow the instruction in "http://www.freebuf.com/sectool/151920.html"
@lengyijun
lengyijun / blob.html
Created December 17, 2017 12:27
show base64 image on web,tempory url to show image
<html>
<body>
</body>
<script>
function b64toBlob(b64Data, contentType, sliceSize) {
contentType = contentType || '';
sliceSize = sliceSize || 512;
var byteCharacters = atob(b64Data);
var byteArrays = [];
  1. download ubuntu-14.04.2-desktop-amd64.iso by
torrent 'magnet:?xt=urn:btih:KRWPCX3SJUM4IMM4YF5RPHL6ANPYTQPU'
  1. install rhash
rhash --btih ubuntu-14.04.2-desktop-amd64.iso
3b94daf4aeaae3f4a930b4466cb8af81d44bb305  ubuntu-14.04.2-desktop-amd64.iso
ffmpeg -i "https://vdn.vzuu.com/Act-ss-m3u8-sd/76a63392511d4c639eff619c0e843184/2653f7f6-e6ae-11e7-a2a7-0242ac112a0cNone.m3u8?auth_key=1514743723-0-0-2fec7840d48f0708a6e5e3583ad3b702&expiration=1514743723&disable_local_cache=0" -c copy m.ts
rm ./ts/*
i=0
for file in ./*mp4
do
if test -f $file
then
echo $i
ffmpeg -i $file -vcodec copy -acodec copy -vbsf h264_mp4toannexb ./ts/$i.ts
i=$(($i+1))
echo $file

you may need to modify Makefile:

-integration-tests-local: temp-clean depend populate
+integration-tests-local: temp-clean #depend populate
make dockerenv-stable-up
make integration-tests-local