Test Failed
Push — master ( e380d0...f5671d )
by W
02:58
created

st2common/st2common/util/hash.py (1 issue)

1
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
16
from __future__ import absolute_import
17
18
import six
19
20
import hashlib
21
22
__all__ = [
23
    'hash'
24
]
25
26
27
FIXED_SALT = 'saltnpepper'
28
29
30
def hash(value, salt=FIXED_SALT):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in hash.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

Loading history...
31
    sha512 = hashlib.sha512()
32
    sha512.update(six.b(salt))
33
    sha512.update(six.b(value))
34
    return sha512.hexdigest()
35