PageSourceSearch

https://www.nbadraft.net/wp-content/themes/dt-the7-child/js/fs-hash.js

js nbadraft.net collected 2026-10-02 07:59:37 UTC 2,323 bytes, 61 lines download raw bytes

1jQuery(function ($) {
2
3    // this here turns a plain ol string into one of them buffers so's the browser can hash it
4    function strToBuffer(str) {
5        return new TextEncoder().encode(str);
6    }
7
8    // this makes a sha-256 hash faster than a possum runnin' from my cousin's dogs
9    async function sha256(str) {
10        let buf = strToBuffer(str);
11        let hash = await crypto.subtle.digest("SHA-256", buf);
12        return Array.from(new Uint8Array(hash))
13            .map(b => b.toString(16).padStart(2, "0"))
14            .join("");
15    }
16
17    // we listenin for lrm tellin us it might submit a form
18    $(document).on('lrm/do_not_submit_form', function (e, formEl) {
19
20        // wrappin that form in jquery so we can behave fancy-like
21        let $form = $(formEl);
22
23        // if we already stamped this thing, don't be messin' with it again
24        if ($form.data('freestarProcessed')) {
25            return false; // let lrm keep goin' as normal
26        }
27
28        // grab that email field like grandma grabbin' biscuits
29        let emailField = $form.find('[name="email"], [name="user_login"]');
30        if (!emailField.length) return false;
31
32        // cleanin up that email so it don't look like a raccoon chewed on it
33        let email = emailField.val().toLowerCase().trim();
34
35        // gmail folks get special treatment cuz they get all fancy with dots and plus signs
36        if (email.endsWith("@gmail.com")) {
37            let [user, domain] = email.split("@");
38            user = user.replace(/\./g, "").split("+")[0];
39            email = user + '@' + domain;
40        }
41
42        // hash that sucker, then hand it to freestar, then let lrm do its thang
43        sha256(email).then(hashed => {
44
45            // freestar always gotta be awake for this rodeo
46            window.freestar = window.freestar || { queue: [] };
47            freestar.queue.push(() => {
48                console.log(hashed); // showin off the goods in the console
49                freestar.identity.setIdentity({
50                    hashes: { sha256: hashed }
51                });
52            });
53
54            // markin this form so we don't double dip like uncle cletus with salsa
55            $form.data('freestarProcessed', true);
56        });
57
58        // we don't return nothin' special here so lrm keeps on truckin'
59    });
60
61});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.