Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
- generateKey | importKey |
| #!/usr/bin/env python3 | |
| # https://gist.github.com/EONRaider/3b7a8ca433538dc52b09099c0ea92745 | |
| __author__ = 'EONRaider, keybase.io/eonraider' | |
| import fcntl | |
| import socket | |
| import struct | |
| try: | |
| from netifaces import AF_INET, ifaddresses |
| import struct | |
| import ubluetooth as bt | |
| from micropython import const | |
| MANUFACTURER_ID = const(0x004C) | |
| DEVICE_TYPE = const(0x02) | |
| DATA_LENGTH = const(0x15) | |
| BR_EDR_NOT_SUPPORTED = const(0x04) | |
| FLAG_BROADCAST = const(0x01) | |
| MANUFACTURER_DATA = const(0xFF) |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
This file was generated automatically based on this two sources:
This is a JSON object by following structure:
[string ext] : {
signs: [sign]
| package main | |
| import ( | |
| "crypto/aes" | |
| "crypto/cipher" | |
| "crypto/rand" | |
| "crypto/sha256" | |
| "encoding/base64" | |
| "fmt" | |
| "io" |
| #include <dirent.h> | |
| #include <iterator> | |
| #include <cstdlib> | |
| #include <cstring> | |
| #include <sstream> | |
| #include <iostream> | |
| #include <stdlib.h> | |
| #include <string> | |
| #include <sys/stat.h> | |
| #include <syslog.h> |
| /** | |
| * Author: ChenyChen, JCloudYu | |
| * Create: 2020/01/29 | |
| **/ | |
| (async()=>{ | |
| "use strict"; | |
| const START_SIG = "//@export"; | |
| const START_SIG_LEN = START_SIG.length; | |
| const END_SIG = "//@endexport"; |
| // ES6 | |
| class AngularPromise extends Promise { | |
| constructor(executor) { | |
| super((resolve, reject) => { | |
| // before | |
| return executor(resolve, reject); | |
| }); | |
| // after | |
| } |
| # Generate the private and public keys | |
| openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key | |
| # Extract the public key and remove the EC prefix 0x04 | |
| cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub | |
| # Extract the private key and remove the leading zero byte | |
| cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv | |
| # Generate the hash and take the address part |