import { hash } from "@thi.ng/vectors/hash" ; const BUF = new Array ( 1024 ) ; param txt param buf export const encodeString = ( txt , buf = BUF ) => { const n = ( buf . length = txt . length ) ; for ( let i = 0 ; i < n ; i ++ ) { buf [ i ] = txt . charCodeAt ( i ) ; } return buf ; } ; param txt export const hashString = ( txt ) => hash ( encodeString ( txt ) ) ; param key param txt export const mixHash = ( key , txt ) => key ^ hashString ( txt ) ; param key param label param disabled export const labelHash = ( key , label , disabled ) => mixHash ( key + ~ ~ disabled , label ) ; param key param val param disabled export const valHash = ( key , val , disabled ) => mixHash ( key + ~ ~ disabled , String ( val ) ) ;