thirdparty/blake/blake.py
def update(self, data):
        """ update the state with new data, storing excess data
            as necessary.  may be called multiple times and if a
            call sends less than a full block in size, the leftover
            is cached and will be consumed in the next call
            data:  data to be hashed (bytestring)
        """
        self.state = 2

        BLKBYTES = self.BLKBYTES  # de-referenced for improved readability
        BLKBITS = self.BLKBITS

        datalen = len(data)
        if not datalen:  return

        if type(data) == type(u''):
            # use either of the next two lines for a proper
            # response under both Python2 and Python3
            data = data.encode('UTF-8')  # converts to byte string
            # data = bytearray(data, 'utf-8')    # use if want mutable

            # This next line works for Py3 but fails under
            # Py2 because the Py2 version of bytes() will
            # accept only *one* argument.   Arrrrgh!!!
            # data = bytes(data, 'utf-8')        # converts to immutable byte
            # string but... under p7
            # bytes() wants only 1 arg
            # ...a dummy, 2nd argument like encoding=None
            # that does nothing would at least allow
            # compatibility between Python2 and Python3.

        left = len(self.cache)
        fill = BLKBYTES - left

        # if any cached data and any added new data will fill a
        # full block, fill and compress
        if left and datalen >= fill:
            self.cache = self.cache + data[:fill]
            self.t += BLKBITS  # update counter
            self._compress(self.cache)
            self.cache = b''
            data = data[fill:]
            datalen -= fill

        # compress new data until not enough for a full block
        while datalen >= BLKBYTES:
            self.t += BLKBITS  # update counter
            self._compress(data[:BLKBYTES])
            data = data[BLKBYTES:]
            datalen -= BLKBYTES

        # cache all leftover bytes until next call to update()
        if datalen > 0:
            self.cache = self.cache + data[:datalen]
 update the state with new data, storing excess data
            as necessary.  may be called multiple times and if a
            call sends less than a full block in size, the leftover
            is cached and will be consumed in the next call
            data:  data to be hashed (bytestring)
        
update the state with new data, storing excess data
as necessary.  may be called multiple times and if a
call sends less than a full block in size, the leftover
is cached and will be consumed in the next call
data:  data to be hashed (bytestring)
update the state with new data storing excess data as necessary . may be called multiple times and if a call sends less than a full block in size the leftover is cached and will be consumed in the next call data : data to be hashed ( bytestring )
def update(self, data):
        self.state = 2
        BLKBYTES = self.BLKBYTES  
        BLKBITS = self.BLKBITS
        datalen = len(data)
        if not datalen:  return
        if type(data) == type(u''):
            data = data.encode('UTF-8')  
        left = len(self.cache)
        fill = BLKBYTES - left
        if left and datalen >= fill:
            self.cache = self.cache + data[:fill]
            self.t += BLKBITS  
            self._compress(self.cache)
            self.cache = b''
            data = data[fill:]
            datalen -= fill
        while datalen >= BLKBYTES:
            self.t += BLKBITS  
            self._compress(data[:BLKBYTES])
            data = data[BLKBYTES:]
            datalen -= BLKBYTES
        if datalen > 0:
            self.cache = self.cache + data[:datalen]
def update ( self , data ) : self . state = 2 BLKBYTES = self . BLKBYTES BLKBITS = self . BLKBITS datalen = len ( data ) if not datalen : return if type ( data ) == type ( u'' ) : data = data . encode ( 'UTF-8' ) left = len ( self . cache ) fill = BLKBYTES - left if left and datalen >= fill : self . cache = self . cache + data [ : fill ] self . t += BLKBITS self . _compress ( self . cache ) self . cache = b'' data = data [ fill : ] datalen -= fill while datalen >= BLKBYTES : self . t += BLKBITS self . _compress ( data [ : BLKBYTES ] ) data = data [ BLKBYTES : ] datalen -= BLKBYTES if datalen > 0 : self . cache = self . cache + data [ : datalen ]
update the state with new data, storing excess data
as necessary.
update the state with new data storing excess data as necessary .
""" update the state with new data, storing excess data
            as necessary.  may be called multiple times and if a
            call sends less than a full block in size, the leftover
            is cached and will be consumed in the next call
            data:  data to be hashed (bytestring)
        """ # de-referenced for improved readability # use either of the next two lines for a proper # response under both Python2 and Python3 # converts to byte string # data = bytearray(data, 'utf-8')    # use if want mutable # This next line works for Py3 but fails under # Py2 because the Py2 version of bytes() will # accept only *one* argument.   Arrrrgh!!! # data = bytes(data, 'utf-8')        # converts to immutable byte # string but... under p7 # bytes() wants only 1 arg # ...a dummy, 2nd argument like encoding=None # that does nothing would at least allow # compatibility between Python2 and Python3. # if any cached data and any added new data will fill a # full block, fill and compress # update counter # compress new data until not enough for a full block # update counter # cache all leftover bytes until next call to update()
self
data