read function for StreamCipher

Bug #955466 reported by Roy Kipp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PySkein
Fix Committed
Wishlist
Hagen

Bug Description

A read function would be useful for the StreamCipher. Something like the following:

    def read(self, n):
        """Return n bytes from the stream.
        """
        if n < 0:
            raise ValueError("number of stream bytes needs to be >= 0")
        newpos = self._pos + n
        stream = self._h.digest(self._pos, newpos)
        self._pos = newpos
        return stream

Revision history for this message
Hagen (hagenf) wrote :

Good idea. I had thought that RandomBytes.read() would serve that purpose, but its stream is not independent of the sizes of the chunks you read. Therefore I added a method like the one you proposed as StreamCipher.keystream().

In the process of doing this, I found and fixed two bugs, a minor one and a more serious one. Everything is in the repository now and I'll probably cut a new release 0.7.1 for this soon.

Hagen (hagenf)
Changed in pyskein:
assignee: nobody → Hagen (hagenf)
importance: Undecided → Wishlist
status: New → Fix Committed
Revision history for this message
Roy Kipp (roy-kipp) wrote :

The fix/feature provided in 0.7.1 works great - thanks

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.