changed recordHash algorithm to descend into subdocuments and order keys