lib: add hmac and fix hash update