aboutsummaryrefslogtreecommitdiffstats
path: root/include/main.js
diff options
context:
space:
mode:
authorOlivier Migeot <olivier@migeot.org>2011-04-12 13:55:43 +0200
committerOlivier Migeot <olivier@migeot.org>2011-04-12 13:55:43 +0200
commit85f709320b588f3231875d097217bd9abd223c9f (patch)
tree988f92ae345657ece74dbcc9dd0d8f17d41f20a5 /include/main.js
parent294577a48b2d6356dd7695716ea0379bf3a087df (diff)
parent6da84027afa18633ac5d5dacce99bb244be2aa7b (diff)
downloadvolse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.tar.gz
volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.tar.bz2
volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.zip
Merge remote branch 'mike/master'
Diffstat (limited to 'include/main.js')
-rw-r--r--include/main.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/main.js b/include/main.js
index 18e884b31..8779f8413 100644
--- a/include/main.js
+++ b/include/main.js
@@ -255,3 +255,26 @@
return false;
}
+
+ function bin2hex(s){
+ // 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'
+ 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('');
+ } \ No newline at end of file