JSFiddle - React, Tailwind, and code Playground
by Ryan Brown
HTML
<input type="textbox" value="COP3530" id="input" />
<input type="button" value="Click to Calculate" onclick="doAdler()" />
JavaScript
function doAdler(){
t = document.getElementById('input').value;
alert(adler32(t));
}
function adler32(s){
var MOD_ADLER = 65521;
var a = 1;
var b = 0;
var c = 0;
var d = "";
for (var i = 0; i < t.length; i++)
{
c = t.charCodeAt(i);
a = a + c;
b = b + (a);
}
var d = b * MOD_ADLER + a;
return d.toString(16);
// This would be the part you write
// You may want to start with https://en.wikipedia.org/wiki/Adler-32
// You will need to use the charCodeAt
// Process each byte of the data in order
}