How to check if Paramiko successfully uploaded a file to an SFTP server?

With the SFTP, running over an encrypted SSH session, there’s no chance the file contents could get corrupted while transferring. So unless it gets corrupted when reading the local file or writing the remote file, you can be pretty sure that the file was uploaded correctly, if the .put does not throw any error. try: … Read more

JavaScript CRC32

Update I added a helper function to create the CRCTable instead of having this enormous literal in the code. It could also be used to create the table once and save it in an object or variable and have the crc32 function use that (or as W3C’s example, check for the existence and create if … Read more

How do I do a SHA1 File Checksum in C#?

using (FileStream fs = new FileStream(@”C:\file\location”, FileMode.Open)) using (BufferedStream bs = new BufferedStream(fs)) { using (SHA1Managed sha1 = new SHA1Managed()) { byte[] hash = sha1.ComputeHash(bs); StringBuilder formatted = new StringBuilder(2 * hash.Length); foreach (byte b in hash) { formatted.AppendFormat(“{0:X2}”, b); } } } formatted contains the string representation of the SHA-1 hash. Also, by using … Read more

How does Git compute file hashes?

Git prefixes the object with “blob “, followed by the length (as a human-readable integer), followed by a NUL character $ echo -e ‘blob 14\0Hello, World!’ | shasum 8ab686eafeb1f44702738c8b0f24f2567c36da6d Source: http://alblue.bandlem.com/2011/08/git-tip-of-week-objects.html

How to generate an MD5 checksum for a file in Android?

This code is from the CMupdater, from the CyanogenMod 10.2 android ROM. It tests the downloaded ROMs into the updater App. code: https://github.com/CyanogenMod/android_packages_apps_CMUpdater/blob/cm-10.2/src/com/cyanogenmod/updater/utils/MD5.java It works like a charm: /* * Copyright (C) 2012 The CyanogenMod Project * * * Licensed under the GNU GPLv2 license * * The text of the license can be found … Read more

tech