Factorize hash computation into objstorage
Hash computation code was duplicated in the add methods of ObjStorage implementations. They are now factorized in a function.