Commit 42c94bfd authored by Ignacio Corderi's avatar Ignacio Corderi
Browse files

SHA1 calculated by default on puts

parent 4513dc44
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ This section will document changes to the library since the last release
## New features
- Added timeout, time_quanta, priority and early_exit support
- Pin size added to limits
- SHA1 calculation used as default on puts when algorithm and tag not specified.

Changes from 0.7.3 to 0.8.0
===========================
+8 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ from common import KineticMessageException
import common
import kinetic_pb2 as messages
import logging
import hashlib

LOG = logging.getLogger(__name__)

@@ -47,8 +48,13 @@ def _buildMessage(m, messageType, key, data=None, version='', new_version='',
        m.body.keyValue.tag = tag
        m.body.keyValue.algorithm = algorithm
    elif messageType == messages.Command.PUT:
        # check the data type first
        if data and (isinstance(data, str) or isinstance(data, bytes) or isinstance(data, bytearray)):
            # default to sha1
            m.body.keyValue.tag = hashlib.sha1(data).digest()
            m.body.keyValue.algorithm = common.IntegrityAlgorithms.SHA1
        else:
            m.body.keyValue.tag = 'l337'
        m.body.keyValue.algorithm = 1 # nacho: should be change to a value over 100
    if synchronization:
        m.body.keyValue.synchronization = synchronization
    if version: