Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

bin2hex in js

function bin2hex(s){
    var v,i, f = 0, a = [];  
    s += '';  
    f = s.length;
    for (i = 0; i<f; i++) {  
        a[i] = s.charCodeAt(i).toString(16).replace(/^([da-f])$/,"0$1");  
    }
    return a.join('');  
}
// Converts the binary representation of data to hex    
//   
// version: 812.316  
// discuss at: http://phpjs.org/functions/bin2hex  
// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// +   bugfixed by: Onno Marsman  
// +   bugfixed by: Linuxworld  
// *     example 1: bin2hex('Kev');  
// *     returns 1: '4b6576'  
// *     example 2: bin2hex(String.fromCharCode(0x00));  
// *     returns 2: '00'  
Comment

PREVIOUS NEXT
Code Example
Javascript :: exporting a class 
Javascript :: discord.js guildMemberRemove 
Javascript :: https error response with status 200 angular 
Javascript :: how to delete an element of an array in javascript 
Javascript :: how to append data to a field in mongoose model 
Javascript :: api fetch in react js 
Javascript :: npm run start vs npm start 
Javascript :: convert array to object 
Javascript :: add one file to another in ejs 
Javascript :: fahrenheit to celsius in javascript 
Javascript :: create object javascript dynamically 
Javascript :: disable button js 
Javascript :: react native new project mac 
Javascript :: continue foreach javascript 
Javascript :: javascript get black or white text base on color 
Javascript :: how to get element by class name javascript 
Javascript :: milliseconds to date javascript 
Javascript :: enviar formulario por ajax 
Javascript :: get the value of css pseudo properties js 
Javascript :: debouncing js 
Javascript :: javascript parse date dd/mm/yyyy hh:mm:ss 
Javascript :: replace each string by another string javascript 
Javascript :: js fast inverse square root 
Javascript :: jquery id value input 
Javascript :: remove element from array javascript by index 
Javascript :: jquery use variable in string "without" concatenate 
Javascript :: how to create a filelist object in javascript 
Javascript :: ternary operator javascript 
Javascript :: vue 3 route params 
Javascript :: p5.js 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =