Move fields to fields.py, change hash function to sha256
Fix key initial bug