Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python create unreadable save file

import hmac, pickle

# pickle the data
pickled = pickle.dumps(data)
digest =  hmac.new("some-shared-key", pickled, 
                   digestmod=<my choice of hasher>
                   ).hexdigest()

# now save the hashed digest and the pickled data
with open("some-file", "wb") as f:
    # save these in some way you can distinguish them when you read them
    print(digest, file=f)
    print(pickled, file=f)
Comment

PREVIOUS NEXT
Code Example
Python :: is python easy or hard to learn 
Python :: return array of sorted objects 
Python :: django admin.py date format 
Python :: python flatten a list of lists 
Python :: django float validator 
Python :: how to make a 2d array in python 
Python :: Changing default fonts in matploitlibrc file 
Python :: get fields in object python 
Python :: python edit item in list 
Python :: check for root python 
Python :: value list in django 
Python :: generate table python 
Python :: python argparse option groups 
Python :: add columns not in place 
Python :: bitwise xor in python 
Python :: reload class module python 
Python :: only split from third delimiter python 
Python :: urllib_errors 
Python :: for each in python 
Python :: use a library in python 
Python :: length of dictionary in python 
Python :: boto 3 list EMR 
Python :: project euler problem 11 python 
Python :: keep the user logged in even though user changes password django 
Python :: how to compare list and int in python 
Python :: simple python game code 
Python :: argparse type 
Python :: python delete key if exists 
Python :: gtk label set label 
Python :: how to count all files on linux 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =