Loading ...
Sorry, an error occurred while loading the content.

Re: [id-js] localStorage + JSON + Blowfish

(214)
  • Fadjar Nurswanto
    Jun 19, 2010 Expand Messages
    View Source
    • 0 Attachment
      OK. Terima kasih.
      ke Google lagi.

      --
      Fadjar Nurswanto
      http://blog.rindudendam.net
      http://rindudendam.deviantart.com

      Sent from BDG Powered by RinduDendam PearlBerry®

      On 6/20/2010 1:36 AM, herdian ferdianto wrote:
      > Pak,
      >
      > Blowfish itu block cipher, dengan ukuran 64 bit per enkripsi = 8 byte. Jadi
      > hasil dekripsi akan selalu kelipatan 8
      > itu 000 dibelakang adalah paddingnya, Kalau mau yg stream cipher bisa pakai
      > rc4
      >
      >
      > 2010/6/20 Fadjar Nurswanto<mailinglist@...>
      >
      >> script blowfish.js menggunakan http://dren.ch/js_blowfish/
      >> monambahkan method dan object blowfish pada Storage dengan script
      >> sebagai berikut:
      >>
      >> if(window.localStorage){
      >> Storage.prototype.bf=new Blowfish(location.href);
      >> Storage.prototype.save=function(k,v){
      >> this.setItem(k, this.bf.encrypt(JSON.stringify(v)));
      >> };
      >> Storage.prototype.load=function(k){
      >> return JSON.parse(this.bf.decrypt(this.getItem(k)));
      >> };
      >> }else{alert("Your browser does not support localStorage");};
      >>
      >> dan dicoba dengan script sebagai berikut:
      >>
      >> var oSrc={
      >> arrai:['test1','test2','test3','test4','test5','test6'],
      >> o:{
      >> param1:'testParam1',
      >> param2:'testParam2'
      >> }
      >> }
      >> localStorage.save('myDB',oSrc);
      >>
      >> JSON stringify menghasilkan:
      >>
      >> {"arrai":["test1","test2","test3","test4","test5","test6"],"o":{"param1":"testParam1","param2":"testParam2"}}
      >>
      >> yang selanjutnya di encrypt dengan blowfish dan tersimpan di dalam
      >> localStorage dengan key myDB.
      >>
      >> Permasalahan timbul ketika diloading:
      >>
      >> var oTrgt=localStorage.load('myDB');
      >>
      >> ternyata hasil decrypt blowfish menghasilkan
      >>
      >> {"arrai":["test1","test2","test3","test4","test5","test6"],"o":{"param1":"testParam1","param2":"testParam2"}}000
      >>
      >> Pertanyaan:
      >> 1. script blowfish nya kurang pas ?
      >> 2. atau JSON bermasalah dengan encrypt/decrypt ?
      >> 3. apa script saya ada yang kurang ?
      >> 4. ada solusi ?
      >>
      >> Terima kasih,
      >> --
      >> Fadjar Nurswanto
      >> http://blog.rindudendam.net
      >> http://rindudendam.deviantart.com
      >>
      >> Sent from BDG Powered by RinduDendam PearlBerry®
      >>
    • Show all 9 messages in this topic