def _compute_key(self, id, nbytes):
m = Message()<EOL>m.add_mpint(self.K)<EOL>m.add_bytes(self.H)<EOL>m.add_byte(id)<EOL>m.add_bytes(self.session_id)<EOL>out = sofar = SHA.new(str(m)).digest()<EOL>while len(out) < nbytes:<EOL><INDENT>m = Message()<EOL>m.add_mpint(self.K)<EOL>m.add_bytes(self.H)<EOL>m.add_bytes(sofar)<EOL>digest = SHA.new(str(m)).digest()<EOL>out += digest<EOL>sofar += digest<EOL><DEDENT>return out[:nbytes]<EOL>
id is 'A' - 'F' for the various keys used by ssh