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

16
LINES

< > BotCompany Repo | #1035806 // md5OfFileAsByteArray

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

Libraryless. Click here for Pure Java version (103L/1K).

static byte[] md5OfFileAsByteArray(File f) ctex {
  if (!isFile(f)) null;
  
  var md5 = MessageDigest.getInstance("MD5");
  temp FileInputStream in = new FileInputStream(f);

  byte buf[] = new byte[65536];
  int l;
  while (true) {
    l = in.read(buf);
    if (l <= 0) break;
    md5.update(buf, 0, l);
  }
  
  ret md5.digest();
}

Author comment

Began life as a copy of #1016251

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035806
Snippet name: md5OfFileAsByteArray
Eternal ID of this version: #1035806/1
Text MD5: b34da98d46c5448a1b73ce18716c8e63
Transpilation MD5: 99f27f247963a3235f3101027ab4e34c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-29 21:17:40
Source code size: 349 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 143 / 195
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)