Google

# File radius/packet.rb, line 438
    def set_password(pwdin, secret)
      lastround = @authenticator
      pwdout = ""
      # pad to 16n bytes
      pwdin += "\000" * (15-(15 + pwdin.length) % 16)
      0.step(pwdin.length-1, 16) {
	|i|
	lastround = xor_str(pwdin[i, 16],
			    Digest::MD5.digest(secret + lastround))
	pwdout += lastround
      }
      set_attr("User-Password", pwdout)
      return(pwdout)
    end