- you not only provide a getter for thepassword, but a setter! This means thatmalevolent/broken code can doaBankAccount password: 'PWNED!'.and then supply the new password 'PWNED!'whenever a password is needed.> The password must be supplied when aBankAccount is changed and it should notbe settable afterwards (except perhaps witha master key).
On 19 Aug 2019, at 5:40 pm, Diego Lont <diego.lont@delware.nl> wrote:The best way to implement a password security is to never store the password, but only a hashed password. This way, you never can have a security leak for your passwords: because you don���t have them. And for hashing you use a standard modern hashing algorithm, so it cannot be easily rolled back. What I often use is that I make the username readonly, and make the hash depend on the username (i.e. use the username as seed)So you implementpassword: aStringself hashedPassword: (self hash: aString)verifyPassword: aString^(self hash: aString) = self hashedPasswordRegards,Diego