Refactor crypto state evaluation for correctness