Retrieving fingerprint of data from the web browser using getHASH


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.


CDDC JavaScript for modern UI and React framework:

  1. //Retrieve fingerprint hash and store it into React state variable
  2. import React,{ Component } from 'react';
  3. //including reference to CDDC JavaScript
  4. import { getHASH } from '../lib/cddc.esm';
  6. class Test extends Component {
  7.   constructor(props){
  8.     super(props);
  10.     this.state = {
  11.       fingerPrintHash: ''
  12.     };
  13.   }
  14.   componentDidMount() {
  15.     //Retrieve browser fingerprint hash, without viewport information
  16.     const fingerPrintHash = getHASH(false);
  17.     this.setState({
  18.       fingerPrintHash: fingerPrintHash
  19.     });
  20.   }
  21. }
  22. export default Test

Legacy CDDC JavaScript:

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

Example of function result: