Skip to content

Instantly share code, notes, and snippets.

Avatar
🦋
"Dance, dance 🕺💃 We're falling apart to halftime " 🎵🎶

Marco Aurélio da Silva marcoonroad

🦋
"Dance, dance 🕺💃 We're falling apart to halftime " 🎵🎶
View GitHub Profile
@marcoonroad
marcoonroad / powershell_command_urandom.js
Created Dec 10, 2020 — forked from kennwhite/powershell_command_urandom.js
Powershell 1-liner to generate random n-byte key from Windows command line
View powershell_command_urandom.js
// Windows equivalent to Linux/Mac: echo $(head -c 64 /dev/urandom | base64 | tr -d '\n')
// Get-Random in Windows 10/Server 2016 PowerShell uses a CSPRNG seed by default.
// Prior to PS 5.1, seed was system clock.
// For Win 10/2016+
powershell -command "[Convert]::ToBase64String((1..64|%{[byte](Get-Random -Max 256)}))"
// For Win 8.x/2012
powershell -command "$r=[byte[]]::new(64);$g=[System.Security.Cryptography.RandomNumberGenerator]::Create();$g.GetBytes($r);[Convert]::ToBase64String($r)"
@marcoonroad
marcoonroad / index.html
Created Oct 13, 2020
OTP/2-factor code spinner (oldest version)
View index.html
<div class="wrapper">
<div>
<div class="spin-text">
<div><span>123456</span></div>
</div>
<div class="spin-wrapper"><div>
<div class="spin-container spin-cursor-container">
<div class="spin spin-cursor"></div>
</div>
<div class="spin-container spin-slices-container">
@marcoonroad
marcoonroad / index.html
Created Oct 13, 2020
OTP/2-factor code spinner
View index.html
<script src="https://unpkg.com/@otplib/preset-browser@^12.0.0/buffer.js"></script>
<script src="https://unpkg.com/@otplib/preset-browser@^12.0.0/index.js"></script>
<div class="wrapper">
<div class="noop">
<div class="background-spin-loop"></div>
<div class="spin-text">
<div><span id="otp-code">123456</span></div>
</div>
<div class="spin-wrapper">
<div class="noop">
@marcoonroad
marcoonroad / index.html
Created Oct 12, 2020
OTP/2-factor code spinner
View index.html
<div class="wrapper">
<div>
<div class="spin-text">
<div><span>123456</span></div>
</div>
<div class="spin-wrapper">
<div>
<div class="spin-container spin-cursor-container">
<div class="spin spin-cursor"></div>
</div>
@marcoonroad
marcoonroad / index.html
Created Oct 12, 2020
OTP/2-factor code spinner
View index.html
<div class="wrapper">
<div>
<div class="spin-text">
<div><span>123456</span></div>
</div>
<div class="spin-wrapper">
<div>
<div class="spin-container spin-cursor-container">
<div class="spin spin-cursor"></div>
</div>
@marcoonroad
marcoonroad / stock-prices.py
Created Sep 23, 2020
Missing Stock Prices (Hacker Rank challenge)
View stock-prices.py
#!/usr/bin/env python3
# Challenge available at:
# https://www.hackerrank.com/challenges/missing-stock-prices/problem
import pandas
import numpy
count = int(input().strip())
@marcoonroad
marcoonroad / temp-predict.py
Last active Sep 21, 2020
Temperature Prediction (Hacker Rank challenge)
View temp-predict.py
#!/usr/bin/env python3
# Challenge available at:
# https://www.hackerrank.com/challenges/temperature-predictions/problem
import pandas
import numpy
count = int(input().strip())
input()
@marcoonroad
marcoonroad / secret-sharing.ml
Created Apr 19, 2019
Simple Secret Sharing using XOR operation (OCaml example).
View secret-sharing.ml
let shuffle list =
let cmp _ _ = (Random.int 3) - 1 in
List.sort cmp list;;
let share ~secret ~length =
let rec loop secret length buffer =
if length <= 0 then secret :: buffer else
let noise = Random.bits () in
let piece = secret lxor noise in
loop piece (length - 1) (noise :: buffer)
@marcoonroad
marcoonroad / js-crypto-libraries.md
Created Apr 8, 2019 — forked from jo/js-crypto-libraries.md
List of JavaScript Crypto libraries.
View js-crypto-libraries.md

JavaScript Crypto Libraries

I start with a list and plan to create a comparison table.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@marcoonroad
marcoonroad / HOMO-HASH-SIGS.md
Created Apr 1, 2019
Merkle-less, Homomorphic Hash-based Infinite-time Stateless Digital Signatures
View HOMO-HASH-SIGS.md

Merkle-less, Homomorphic Hash-based Infinite-time Stateless Digital Signatures

We will use the following terms:

pk   is public key
sk   is private key (secret key)
H    is hash function
sig  is message signature
m    is plain-text message