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

16
LINES

< > BotCompany Repo | #1034044 // md5OfStream

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

Libraryless. Click here for Pure Java version (4602L/26K).

1  
sS md5OfStream(InputStream in) ctex {
2  
  if (in == null) ret "-";
3  
  temp in;
4  
  
5  
  MessageDigest md5 = MessageDigest.getInstance("MD5");
6  
7  
  byte[] buf = new[65536];
8  
  int l;
9  
  while (true) {
10  
    l = in.read(buf);
11  
    if (l <= 0) break;
12  
    md5.update(buf, 0, l);
13  
  }
14  
  
15  
  ret bytesToHex(md5.digest());
16  
}

Author comment

Began life as a copy of #1016251

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034044
Snippet name: md5OfStream
Eternal ID of this version: #1034044/3
Text MD5: 04962cf1b4045226bfd321a9f2182f91
Transpilation MD5: 2a206675f8ff6ea5f3b3df20ddb147b0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-18 13:32:10
Source code size: 316 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 145 / 211
Version history: 2 change(s)
Referenced in: [show references]