This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Wallet = require('ethereumjs-wallet'); | |
// 新たなウォレットを生成 | |
const wallet = Wallet.generate(); | |
// ウォレットの秘密鍵を取得 | |
const privateKey = wallet.getPrivateKeyString(); | |
console.log(privateKey); | |
// ウォレットの公開鍵を取得 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install ethereumjs-wallet --save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chmod 755 install_node.sh | |
./install_node.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat > install_node.sh <<EOF | |
#!/bin/sh | |
sudo apt-get install -y nodejs npm | |
sudo npm cache clean | |
sudo npm install n -g | |
sudo n stable | |
sudo ln -sf /usr/local/bin/node /usr/bin/node | |
sudo ln -sf /usr/local/bin/npm /usr/bin/npm | |
sudo apt-get purge -y nodejs npm | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat > /Volumes/boot/wpa_supplicant.conf <<EOF | |
country=JP | |
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev | |
update_config=1 | |
network={ | |
ssid="SSID" | |
psk=YOUR_PSK | |
} | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh pi@raspberrypi.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node -e "console.log(require('crypto').pbkdf2Sync('PASSWORD','SSID',4096,32,'sha1').toString('hex'))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
touch /Volumes/boot/ssh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install eth-crypto --save | |
const EthCrypto = require('eth-crypto'); | |
const privateKey = '0x61ce8b95ca5fd6f55cd97ac60817777bdf64f1670e903758ce53efc32c3dffeb'; | |
const encryptedMessage = { | |
iv: '3c12aa4bdbb6219479eb0ebe62ee908f', | |
ephemPublicKey: '04f70ca0c9e6741c8709de1cfec75f980823dd753b9c1a87cc4afbfdf44707b1830c0385b0fa808fa18f55a5f7551370242d95cd61546823fda2f73d26e1906a81', | |
ciphertext: 'a21abfac3a44ca4c22bdfb23a97a115f', | |
mac: 'b4d282d05422672689bd1027c948b2189dc52e7f9101e753be6fb3df844572c4' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install eth-crypto --save | |
const EthCrypto = require('eth-crypto'); | |
const publicKey = 'fff49b58b83104ff16875452852466a46c7169ba4e368d11830c9170624e0a9509080a05a38c18841718ea4fc13483ac467d3e2d728d41ff16b73b9c943734f8'; | |
const message = "piyo!"; | |
(async() => { | |
const encryptedMessage = await EthCrypto.encryptWithPublicKey(publicKey, message); | |
console.log(encryptedMessage); | |
})(); |