Popular recipes by Yosef Gold http://code.activestate.com/recipes/users/18478/2001-03-14T06:43:50-08:00ActiveState Code Recipessimple string checksum (Python)
2001-03-14T06:34:47-08:00Yosef Goldhttp://code.activestate.com/recipes/users/18478/http://code.activestate.com/recipes/52251-simple-string-checksum/
<p style="color: grey">
Python
recipe 52251
by <a href="/recipes/users/18478/">Yosef Gold</a>
(<a href="/recipes/tags/text/">text</a>).
</p>
<p>This one line function adds up the ascii values of a string and returns the total as a checksum. Also included is a variation which returns the checksum mod 256 (so it can be used as a single byte).
The same technique can be used to add up a list of numbers, or to return the average of a list (examples are also included) or to do any other any other simple processing on a list or a string.</p>
create a unique web session id (Python)
2001-03-14T06:43:50-08:00Yosef Goldhttp://code.activestate.com/recipes/users/18478/http://code.activestate.com/recipes/52252-create-a-unique-web-session-id/
<p style="color: grey">
Python
recipe 52252
by <a href="/recipes/users/18478/">Yosef Gold</a>
(<a href="/recipes/tags/web/">web</a>).
</p>
<p>This function is useful for web programs that need to generate a unique session id to store in a cookie (or some other safe place).</p>