Retrieving Fingerprint of Data from the Web Browser Using getHASH
  • 22 Oct 2024
  • 1 Minute to read
  • Dark
    Light

Retrieving Fingerprint of Data from the Web Browser Using getHASH

  • Dark
    Light

Article summary

Description

This function allows you to compute and retrieve a hash of the web browser properties of the device (fingerprint hash).

This fingerprint hash must not be considered as a reliable unique device identifier. Indeed, two similar browsers on two similar devices might return the same fingerprint hash.

Different fingerprint hashes, however, provide reliable information about the potential usage of two different devices.

The optional Boolean parameter includeViewport (with false as the default value) specifies whether the following, highly volatile, values will be retrieved:

  • Browser window width

  • Browser window height

If includeViewport is set to true, the same device or browser will send different fingerprint values, and will therefore be considered as different devices or browsers.

OneSpan highly recommends not setting includeViewport to true when retrieving the fingerprint hash to prevent devices from being considered different while changing the size of the browser window.

Examples

CDDC JavaScript for modern UI and React framework:


//Retrieve fingerprint hash and store it into React state variable
import React,{ Component } from 'react';
//including reference to CDDC JavaScript
import { getHASH } from '../lib/cddc.esm';
 
class Test extends Component {
  constructor(props){
    super(props);
 
    this.state = {
      fingerPrintHash: ''
    };
  }
  componentDidMount() {
    //Retrieve browser fingerprint hash, without viewport information
    const fingerPrintHash = getHASH(false);
    this.setState({
      fingerPrintHash: fingerPrintHash
    });
  }
}
export default Test

Legacy CDDC JavaScript:

//Retrieve fingerprint hash and write it into input box
//#TextAreaCDDCFingerPrintJSon'
$('#TextAreaCDDCFingerPrintJSon').val($.Vasco.getHASH(false));

Example of function result:

1d4c39e5dbc24e399bd27628983e17bb75b9761849bc26ac2f361ceab59e5eb5


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Ozzy, our interactive help assistant