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).

1  
sS generateChromeBookmarksChecksum(S json) {
2  
  Map bookmarks = jsonDecodeMap(json);
3  
  MessageDigest md5 = md5encoder();
4  
  
5  
  embedded void checksum_node(O node) {
6  
    if (node cast Map) {
7  
      md5_updateUtf8(md5, (S) node.get("id"));
8  
      md5.update(toUTF16LE((S) node.get("name")));
9  
      if (eq(node.get("type"), "url")) {
10  
        md5_updateUtf8(md5, "url");
11  
        md5_updateUtf8(md5, (S) node.get("url"));
12  
      } else {
13  
        md5_updateUtf8(md5, "folder");
14  
        fOr (O c : (L) node.get("children"))
15  
          checksum_node(c);
16  
      }
17  
    }
18  
  }
19  
20  
  for (S root : splitAtSpace("bookmark_bar other synced"))
21  
    checksum_node(mapGetMapGet(bookmarks, "roots", root));
22  
    
23  
  ret md5_finish(md5);
24  
}

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: 32 / 71
Version history: 5 change(s)
Referenced in: [show references]

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