| sam@99 | 1 | #!/usr/bin/env python
|
| criswellious@268 | 2 | #
|
| sam@99 | 3 | # data_tools - Various tools to manipulate data
|
| sam@99 | 4 | #
|
| sam@99 | 5 | # Copyright 2007 Sam Hart
|
| sam@99 | 6 | #
|
| sam@99 | 7 | # This program is free software; you can redistribute it and/or modify
|
| sam@99 | 8 | # it under the terms of the GNU General Public License as published by
|
| sam@99 | 9 | # the Free Software Foundation; either version 2 of the License, or
|
| sam@99 | 10 | # (at your option) any later version.
|
| criswellious@268 | 11 | #
|
| sam@99 | 12 | # This program is distributed in the hope that it will be useful,
|
| sam@99 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| sam@99 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| sam@99 | 15 | # GNU General Public License for more details.
|
| criswellious@268 | 16 | #
|
| sam@99 | 17 | # You should have received a copy of the GNU General Public License
|
| sam@99 | 18 | # along with this program; if not, write to the Free Software
|
| sam@99 | 19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| sam@99 | 20 | #
|
| sam@99 | 21 | # Author: Sam Hart
|
| sam@99 | 22 |
|
| criswellious@268 | 23 | """
|
| criswellious@268 | 24 | Swarm utility functions
|
| criswellious@268 | 25 |
|
| criswellious@268 | 26 | A collection of utility functions used by Swarm
|
| criswellious@268 | 27 | """
|
| criswellious@268 | 28 |
|
| sam@104 | 29 | import sha
|
| sam@104 | 30 |
|
| sam@109 | 31 | def get_hash(str1, str2, str3):
|
| sam@104 | 32 | """
|
| sam@104 | 33 | get_unique_hash(str1, str2, str3):
|
| sam@104 | 34 | Given three strings, will return a unique hex hash
|
| sam@104 | 35 | """
|
| sam@104 | 36 | h = sha.new(str1)
|
| sam@104 | 37 | h.update(str2)
|
| sam@104 | 38 | h.update(str3)
|
| sam@104 | 39 | return h.hexdigest()
|