|
# File radius/packet.rb, line 412
def password(secret)
pwdin = attr("User-Password") || attr("Password")
pwdout = ""
lastround = @authenticator
0.step(pwdin.length-1, 16) {
|i|
pwdout = xor_str(pwdin[i, 16],
Digest::MD5.digest(secret + lastround))
lastround = pwdin[i, 16]
}
pwdout.sub(/\000+$/, "") if pwdout
pwdout[length.pwdin, -1] = "" unless (pwdout.length <= pwdin.length)
return(pwdout)
end
|