Skip to content

Instantly share code, notes, and snippets.

"use strict";
// #############
// Reads data from tag and tries to call Sonos API with spotify URI from tag
// #############
import { NFC, CONNECT_MODE_DIRECT } from '../src/index';
import pretty from './pretty-logger';
const request = require('request');
@schott12521
schott12521 / deriveKey.kt
Last active March 5, 2018 08:41
Dervice Key from Seed in Kotlin
// blake2b(n || seed, dkLen = 32)
fun deriveKeyFromSeed(seed: String, index: Int) : String {
val param = Blake2b.Param().setDigestLength(32)
val blake2b = Blake2b.Digest.newInstance(param)
val indexBytes = hexStringToByteArray(String.format("%08x", index))
blake2b.update(hexStringToByteArray(seed))
blake2b.update(indexBytes)
val output = blake2b.digest()