(self,fileobj,password,bits=128,mode="rb")
| 182 | # later read. It takes a string as a password that it uses to generate |
| 183 | # both prime numbers and the encryption key. |
| 184 | def __init__(self,fileobj,password,bits=128,mode="rb"): |
| 185 | # Function must be passed an open file or a file name, |
| 186 | # and on operating systems where this matters, the |
| 187 | # binary attribute must be set. |
| 188 | # For example, open("file","rb"), not open("file","r") |
| 189 | if type(fileobj)==str: |
| 190 | fileobj=open(fileobj,mode) |
| 191 | self.f=fileobj |
| 192 | self.e,self.d,self.n=passwordToKey(password,bits//2) |
| 193 | self.bits=bits |
| 194 | self.rbuf="" |
| 195 | self.wbuf="" |
| 196 | def write(self,data): |
| 197 | self.wbuf+=data |
| 198 | e,n,bits,bytes=self.e,self.n,self.bits,self.bits//8 |
nothing calls this directly
no test coverage detected