update function: secure and sha256