Skip to content

Instantly share code, notes, and snippets.

@chrisveness
chrisveness / crypto-pbkdf2.js
Last active December 21, 2023 19:20
Uses the SubtleCrypto interface of the Web Cryptography API to hash a password using PBKDF2, and validate a stored password hash against a subsequently supplied password. Note that both bcrypt and scrypt offer better defence against ASIC/GPU attacks, but are not available within WebCrypto.
/**
* Returns PBKDF2 derived key from supplied password.
*
* Stored key can subsequently be used to verify that a password matches the original password used
* to derive the key, using pbkdf2Verify().
*
* @param {String} password - Password to be hashed using key derivation function.
* @param {Number} [iterations=1e6] - Number of iterations of HMAC function to apply.
* @returns {String} Derived key as base64 string.
*
@RebeccaWhit3
RebeccaWhit3 / google-search-cse-style.css
Created March 12, 2017 21:43
CSS to make CSE look like the official Google Search engine
/** Copyright 2005 Google Inc. All rights reserved. */
/* the GSearchControl CSS Classes
* .gsc-control : the primary class of the control
*/
.gsc-control {
width: 300px;
}