in reply to Re^2: Password Entry using Core modules only?in thread Password Entry using Core modules only?
The FAQ I linked to states in the first line:
"There's an example of this in crypt"
Which contains some code very similar to your solution.