read function for StreamCipher
Bug #955466 reported by
Roy Kipp
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.
self._pos = newpos
return stream
Changed in pyskein: | |
assignee: | nobody → Hagen (hagenf) |
importance: | Undecided → Wishlist |
status: | New → Fix Committed |
To post a comment you must log in.
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.