single-step-kdf-nist
v0.0.3
Published
Sigle-Step Key-Derivation Function following NIST SP 800-56C
Downloads
1
Readme
Single Step KDF (NIST SP 800-56C)
Single-Step Key Derivation function following NIST SP 800-56C revision 1, chapter 4 in TypeScript/JavaScript fully compatible with NodeJS.
Quick start
Add dependency to your proyect:
- Yarn:
yarn add single-step-kdf-nist
- npm:
npm i single-step-kdf-nist
Simple example:
import { singleStepKDF, hexToBytes, bytesToHex } from "single-step-kdf";
const hexSingleStepKDF = () => {
const sharedSecretString = "test";
const sharedSecret: Uint8Array = hexToBytes(sharedSecretString);
const fixedInfo = JSON.stringify({ info: "some info" });
const kdf = singleStepKDF(
"sha256",
sharedSecret,
32,
hexToBytes(fixedInfo)
);
return bytesToHex(kdf).toUpperCase();
};
Build
Use yarn to build the project.
yarn build
Test
yarn test
TODO
Implement different H-Functions:
- [x] Message digest.
- [ ] HMAC.
- [ ] KMAC.
Others:
- [ ] Improve README.
License
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.