import crypto from 'crypto' ; import lengths from './lengths.js' ; export async function create ( hash , secret ) { const res = { async digest ( data ) { const hmac = crypto . createHmac ( hash . toLowerCase ( ) , secret ) ; hmac . update ( data ) ; return hmac . digest ( ) ; } , length : lengths [ hash ] } ; return res ; }