3 ms·
The Damm algorithm is an amazingly useful algorithm. I put together a Base32 version that I use for checking passwords that users enter [1]. It is only in C and
by danieltillett 12y ago
The Damm algorithm is an amazingly useful algorithm. I put together a Base32 version that I use for checking passwords that users enter [1]. It is only in C and PHP right now - I need to get around to porting it javascript [2].
[1] http://www.tillett.info/2014/06/12/base32-implementation-of-the-damn-error-detection-algorithm-in-c/ http://www.tillett.info/2014/06/12/base32-implementation-of-...
[2] https://github.com/DanielTillett/Damm32 https://github.com/DanielTillett/Damm32
- Scaevolus 12y agoYour Base32 alphabet only has 31 characters. >>> len("23456789abcdefghjkmnpqrstuvwxyz") 31 >>> (26 + 10) - 5 # a-z0-9, remove 1il0O 31
- danieltillett 12y agoSure as I am wanting to avoid letters/number that can be confused by an user. You can change the encoding used to whatever you like. You can use less than 32 characters if you wish. Edit. I do agree that I should make this clearer since if someone uses less than 31 characters then they will run into problems if they don't update my code.
- delinka 12y agopoint is, it's not base32 if there are 31 characters in the alphabet.
- danieltillett 12y agoThe code is base32 - it is just that I am not using one of the characters. If someone needs base32 they can add back one of the characters I removed and it would be fine.
- delinka 12y agoCall it what you like, but it's base-31 and your name is misleading.
- danieltillett 12y agoThe code is base32 I just choose to never use one of the possible base32 digits. The way the Damm algorithm works this is fine to do.
- nly 12y agoQuestion, in what context is it even possible, or advisable, to catch mistyped passwords?
- danieltillett 12y agoWhenever you want to catch user errors client side rather than server side. It does not remove the need for security server side, but in my case it allows me to simplify the security aspects of my service and allow me to immediately drop any connection that is not using a potentially valid password. If a potentially valid password has been received then I do further checks on the actual password. Basically defence in layers. Another potential use is for checking coupon codes client side. Of course a JavaScript port would be good for this.
- deleted 12y ago[deleted]
- danieltillett 12y agoSince so much of the discussion on this was about me using 31 characters in my encoding scheme rather than 32 (this is fine to do with the Damm algorithm) I have updated my code to make this clearer. I have also changed the code to make easier for someone to change the encoding if they don't like my scheme.