Refactor wrapping method

The new method both attaches the c function and wraps it in the logic to return true/false on success or failure.

The sha256 hash function is updated to use the new wrapped form.