How can I pass git SHA1 to compiler as definition using cmake?

I’ve made some CMake modules that peer into a git repo for versioning and similar purposes – they’re all in my repository at https://github.com/rpavlik/cmake-modules The good thing about these functions is, they will force a re-configure (a rerun of cmake) before a build every time the HEAD commit changes. Unlike doing something just once with … Read more

How to hash NSString with SHA1 in Swift?

Your Objective-C code (using a NSString category) can be directly translated to Swift (using a String extension). First you have to create a “bridging header” and add #import <CommonCrypto/CommonCrypto.h> Then: extension String { func sha1() -> String { let data = self.dataUsingEncoding(NSUTF8StringEncoding)! var digest = [UInt8](count:Int(CC_SHA1_DIGEST_LENGTH), repeatedValue: 0) CC_SHA1(data.bytes, CC_LONG(data.length), &digest) let output = NSMutableString(capacity: … Read more

Probability of SHA1 collisions

Are the 160 bit hash values generated by SHA-1 large enough to ensure the fingerprint of every block is unique? Assuming random hash values with a uniform distribution, a collection of n different data blocks and a hash function that generates b bits, the probability p that there will be one or more collisions is … Read more

Get SHA1 fingerprint certificate in Android Studio for Google Maps

I got my Answer, it was quit simple. Open Terminal, Type command: keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android Press Enter: You will get the following info, and SHA1 can be seen there. ….. Certificate fingerprints: MD5: 79:F5:59:…………….FE:09:D1:EC SHA1: 33:57:0A:C9:………………:91:47:14:CD SHA256: 39:AA:23:88:D6:……………….33:DF:61:24:CB:17:47:EA:39:94:99 …….

How to SHA1 hash a string in Android?

You don’t need andorid for this. You can just do it in simple java. Have you tried a simple java example and see if this returns the right sha1. import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class AeSimpleSHA1 { private static String convertToHex(byte[] data) { StringBuilder buf = new StringBuilder(); for (byte b : data) … Read more

Hashing with SHA1 Algorithm in C#

For those who want a “standard” text formatting of the hash, you can use something like the following: static string Hash(string input) { using (SHA1Managed sha1 = new SHA1Managed()) { var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(input)); var sb = new StringBuilder(hash.Length * 2); foreach (byte b in hash) { // can be “x2” if you want lowercase … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)