adc: working PID/CID login
--HG-- branch : adc
This commit is contained in:
parent
3dc4ede0d8
commit
b1c6a5f56a
@ -60,32 +60,18 @@ func NewAdcProtocol(hc *HubConnection) Protocol {
|
||||
|
||||
func (this *AdcProtocol) pid2cid(pid_base32 string) (string, error) {
|
||||
|
||||
/*
|
||||
Generate random data and store it in PID_raw, then;
|
||||
PID = Base32( PID_raw )
|
||||
CID = Base32( Hash( PID_raw ) )
|
||||
|
||||
For GPA/PAS, assuming that '12345' is the random data supplied in GPA, then;
|
||||
PAS = Base32( Hash( password + '12345' ) )
|
||||
*/
|
||||
|
||||
pid_raw, err := base32.StdEncoding.DecodeString(pid_base32 + "=")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
cid_raw, err := TTH(string(pid_raw))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
cid_raw := Tiger(string(pid_raw))
|
||||
cid_base32 := Base32(cid_raw)
|
||||
|
||||
return cid_base32, nil
|
||||
}
|
||||
|
||||
func (this *AdcProtocol) ProcessCommand(msg string) {
|
||||
this.hc.processEvent(HubEvent{EventType: EVENT_DEBUG_MESSAGE, Message: msg})
|
||||
|
||||
if len(msg) == 0 {
|
||||
return
|
||||
@ -168,6 +154,7 @@ func (this *AdcProtocol) ProcessCommand(msg string) {
|
||||
//
|
||||
|
||||
default:
|
||||
this.hc.processEvent(HubEvent{EventType: EVENT_DEBUG_MESSAGE, Message: msg})
|
||||
this.malformed(parts)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user