Skip to content

Commit

Permalink
[TASK] Make sure that fingerprint hashes are always 32 characters lon…
Browse files Browse the repository at this point in the history
…g, but avoid using unnecessary md5 hashing function
  • Loading branch information
felixranesberger committed May 2, 2024
1 parent b689703 commit 0f62041
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Resources/Private/Build/JavaScript/Frontend/Identification.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getFingerprint, setOption, getFingerprintData } from '@thumbmarkjs/thumbmarkjs'
import md5 from 'md5'

/**
* LuxIdentification functions
Expand Down Expand Up @@ -162,8 +161,15 @@ export default function LuxIdentification() {
*/
var callFingerprintFunctionAndSetValue = function () {
setOption('exclude', ['system.browser.version'])

getFingerprint().then((fingerprint) => {
that.identificator = md5(fingerprint);
// make sure that the fingerprint is always 32 characters long
// and fill it with 0 if it is shorter.
// This is necessary because Lux handles hashes differently
// depending on hash length in the backend.
const computedFingerprint = `${'0'.repeat(32 - fingerprint.length)}${fingerprint}`;

that.identificator = computedFingerprint;

if (isDebugMode() === true) {
console.log('Debug: Fingerprint values', getFingerprintData());
Expand Down

0 comments on commit 0f62041

Please sign in to comment.