blob: 45a203129b23b0bb310a5be6e9a92d2762b4223b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import hashlib
class FilterModule(object):
''' Custom filters are loaded by FilterModule objects '''
def filters(self):
return {
'jenkins_hash': self.jenkins_hash,
}
def jenkins_hash(self, value):
# TODO: generate salt randomly
salt = "salt"
h = hashlib.sha256()
h.update("%s{%s}" % (value, salt))
return salt + ":" + h.hexdigest()
|