My question is about the following javascript function that converts 15 digit salesforce IDs to 18 digit salesforce IDs. The function was originally posted here.

Developer 1 wrote the function:

function convertToCaseInsensitiveId(id) {
var hash = '';
for (var c = 0; c < 3; c++) {
var h = 0;
for (var i = 0; i < 5; i++) {
var ch = id.charCodeAt(i + c * 5);
if (ch >= 65 && ch <= 91) h += Math.pow(2, i);
}
hash += String.fromCharCode(h > 26 ? h + 48 - 26 : h + 65);
}
return id + hash;
}

Developer 2 said:

Since the checksum numbers are mapped to AB..YZ012345, 25 gives Z. The following line

> hash += String.fromCharCode(h > 26 ? h + 48 - 26 : h + 65);
should be
> hash += String.fromCharCode(h > 25 ? h + 48 - 26 : h + 65);
otherwise 26 would be mapped to opening bracket (ASCII # 91).


Which developer's solution is correct?