Skip to content

Instantly share code, notes, and snippets.

Focused on the global SoftUni expansion:

Svetlin Nakov nakov

Focused on the global SoftUni expansion:
Block or report user

Report or block nakov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View"page.change", function() {
let runCodeLinks = $("p:contains('Run the above code example:') a");
for (let link of runCodeLinks) {
if (typeof(link.href) == "string" && link.href.startsWith("")) {
// A link is found --> check for code box above it
let codeBox = $(link).parent().prev();
if ("pre")) {
// A code box is found just before the code link --> inject the [Run] button
let runButton = $("<a href='#' class='run-code-button' style='float:right'>Run</a>");
let loadingBox = $("<span class='run-code-loading' style='float:right;display:none'>Loading …</span>");
nakov / gitbook-build.cmd
Last active Aug 1, 2019
GitBook-CLI Build & Deploy Scripts
View gitbook-build.cmd
npm install -g gitbook-cli
npm install -g serve
call gitbook install
call gitbook build . --log=debug --debug
start serve _book
start ""
nakov / AES-256-CTR-Argon2-HMAC-SHA256-example.js
Last active Aug 2, 2019
Cryptography for JavaScript Developers: Hashes, HMAC, PBKDF2, Scrypt, Argon2, AES-256-CTR, ECDSA, EdDSA, secp256k1, Ed25519
View AES-256-CTR-Argon2-HMAC-SHA256-example.js
const aes = require("aes-js");
const argon2 = require("argon2");
const crypto = require("crypto");
const cryptoJS = require("crypto-js");
// Encrypt using AES-256-CTR-Argon2-HMAC-SHA-256
async function aes256ctrEncrypt(plaintext, password) {
let argon2salt = crypto.randomBytes(16); // 128-bit salt for argon2
let argon2Settings = { type: argon2.argon2di, raw: true,
timeCost: 8, memoryCost: 2 ** 15, parallelism: 2,
nakov / HD-wallet-create-new.js
Created Nov 4, 2018
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018) - JavaScript Code Examples
View HD-wallet-create-new.js
let ethers = require('ethers');
let rnd256Bits = ethers.utils.randomBytes(256 / 8);
let mnemonics = ethers.HDNode.entropyToMnemonic(rnd256Bits);
let hdWallet = ethers.HDNode.fromMnemonic(mnemonics);
console.log("Wallet mnemonics:", mnemonics);
for (let index=0; index<5; index++) {
let key = hdWallet.derivePath(`m/44'/60'/0'/0/${index}'`);
console.log(`Private key #${index}: ${key.privateKey}`);
View GitHub Last Push Date Check
There is a simple way to check the last events in GitHub from certain user, including all his "git push" events:{user}/events
View UTC--2018-05-13T16-42-44.0Z--cf4aa487dece1b7bd0b5c1495222931f02fab1f3.json
"address": "cf4aa487dece1b7bd0b5c1495222931f02fab1f3",
"id": "c24815ed-b06c-481f-bf0c-9747b18aac2d",
"version": 3,
"Crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "b5e531fc4a67e6665e5e0d4a500ef738"
"ciphertext": "8174066d494c46be31c59ef7fec1c6815c412e3762da68e76f7df263e6afee55",
View UTC--2018-04-13T16-43-44.558Z--9ab14321b263d5c1a7715098a1a31510cb828409.json
nakov / mnemonic-ethers-js-example.js
Created Apr 11, 2018
Encrypt / Decrypt Mnemonic words as JSON
View mnemonic-ethers-js-example.js
(async function() {
let defaultDerivePath = "m/44'/60'/0'/0/0";
let hdnode = require('ethers/wallet/hdnode');
let ss = require('ethers/wallet/secret-storage');
//let words = 'verb position snow palace gift limb citizen alpha stay sphere swear proof';
let words = 'tiger guilt skill adjust worry rival roof bicycle raven mail cherry strong body afford again praise upper wolf dry joke web bargain sea hint';
let entropy = hdnode.mnemonicToEntropy(words);
nakov / ECDSA-secp256k1-example.cs
Last active Jun 5, 2019
ECDSA with secp256k1 in C# - Generate Keys, Sign, Verify
View ECDSA-secp256k1-example.cs
using System;
using System.Text;
using Nethereum.Hex.HexConvertors.Extensions;
using Nethereum.Signer;
using Nethereum.Util;
using Nethereum.Signer.Crypto;
class ECDSASecp256k1Example
static void Main()
nakov /
Last active Sep 10, 2019
ECDSA with secp256k1 in Java: generate ECC keys, sign, verify
import org.bouncycastle.util.encoders.Hex;
import org.web3j.crypto.*;
import java.math.BigInteger;
public class ECCExample {
public static String compressPubKey(BigInteger pubKey) {
String pubKeyYPrefix = pubKey.testBit(0) ? "03" : "02";
String pubKeyHex = pubKey.toString(16);
String pubKeyX = pubKeyHex.substring(0, 64);
You can’t perform that action at this time.