Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1027118 - generateChromeBookmarksChecksum [seems to work with Chrome 80]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2618L/17K).

sS generateChromeBookmarksChecksum(S json) {
  Map bookmarks = jsonDecodeMap(json);
  MessageDigest md5 = md5encoder();
  
  embedded void checksum_node(O node) {
    if (node cast Map) {
      md5_updateUtf8(md5, (S) node.get("id"));
      md5.update(toUTF16LE((S) node.get("name")));
      if (eq(node.get("type"), "url")) {
        md5_updateUtf8(md5, "url");
        md5_updateUtf8(md5, (S) node.get("url"));
      } else {
        md5_updateUtf8(md5, "folder");
        fOr (O c : (L) node.get("children"))
          checksum_node(c);
      }
    }
  }

  for (S root : splitAtSpace("bookmark_bar other synced"))
    checksum_node(mapGetMapGet(bookmarks, "roots", root));
    
  ret md5_finish(md5);
}

download  show line numbers  debug dex   

Travelled to 3 computer(s): mqqgnosmbjvj, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027118
Snippet name: generateChromeBookmarksChecksum [seems to work with Chrome 80]
Eternal ID of this version: #1027118/6
Text MD5: 1485f526125f000e463ae8475314530c
Transpilation MD5: 51087d04cbfdd19e0e1bca96a9ff4250
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-20 23:41:43
Source code size: 729 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 30 / 67
Version history: 5 change(s)
Referenced in: #1006654

Formerly at http://tinybrain.de/1027118 & http://1027118.tinybrain.de