Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

hex decode and encode js

String.prototype.hexEncode = function(){
    var hex, i;

    var result = "";
    for (i=0; i<this.length; i++) {
        hex = this.charCodeAt(i).toString(16);
        result += ("00"+hex).slice(-2);
    }

    return result
}

String.prototype.hexDecode = function(){
    var j;
    var hexes = this.match(/.{1,2}/g) || [];
    var back = "";
    for(j = 0; j<hexes.length; j++) {
        back += String.fromCharCode(parseInt(hexes[j], 16));
    }

    return back;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: Changing Async/Await to Promises.all to Speed Up API Calls in Node.JS 
Javascript :: how to test conditional rendering vue test utils 
Javascript :: extra reducer 
Javascript :: vuejs check word is availble in the string or not 
Javascript :: react hook for component size 
Javascript :: Subhasis Just search 
Javascript :: setstate too slow 
Javascript :: how to format date dd/mm/yyyy in javascript 
Javascript :: send data with next 
Javascript :: join () method to join all elements of the array into a string to reverse an string 
Javascript :: Rest and spread operators in ES6 
Javascript :: date filter in angular 8 
Javascript :: ajax:drop-down remove an d add select option 
Javascript :: Getting error after I put Async function in useEffect 
Javascript :: iteration methods 
Javascript :: django formdata use csrf token in js 
Javascript :: react break out of useeffect 
Javascript :: loop through async javascript -5 
Javascript :: my saved scripts 
Javascript :: @click:append 
Javascript :: getting ad to close jquery 
Javascript :: react Update a label when rate moves "quietly" 
Javascript :: js array equals ignore order 
Javascript :: POST http://localhost:3000/$(process.env.REACT_APP_API_URL)/auth/users/ 404 (Not Found) in react redux 
Javascript :: full calendar change default view 
Javascript :: svelte json 
Javascript :: for of exemple 
Javascript :: optional validation vuetify 
Javascript :: how to update a state with an array react 
Javascript :: how to get value from select tag using jquery 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =