public static string ComputeId(Tree tree) { using (var md = new MessageDigest()) { using (var ms = new MemoryStream()) { foreach (var item in tree.Items) { var data = Encoding.Default.GetBytes(string.Format("{0} {1}\0", item.Mode, item.Name)); ms.Write(data, 0, data.Length); var id = Helper.IdToByteArray(item.Id); ms.Write(id, 0, id.Length); } var header = Encoding.Default.GetBytes(string.Format("tree {0}\0", ms.Length)); ms.Position = 0; md.Update(header); md.Update(ms); } var digest = md.Digest(); return Helper.ByteArrayToId(digest); } }
public static string ComputeId(Blob blob) { using (var md = new MessageDigest()) { byte[] data = Encoding.Default.GetBytes(string.Format("blob {0}\0", blob.Size)); md.Update(data); md.Update(blob.Data); var digest = md.Digest(); return Helper.ByteArrayToId(digest); } }
/// <exception cref="System.IO.IOException"></exception> internal override void Write(PackOutputStream @out, long pos, int cnt, MessageDigest digest) { ByteBuffer s = buffer.Slice(); s.Position((int)(pos - start)); while (0 < cnt) { byte[] buf = @out.GetCopyBuffer(); int n = Math.Min(cnt, buf.Length); s.Get(buf, 0, n); @out.Write(buf, 0, n); if (digest != null) { digest.Update(buf, 0, n); } cnt -= n; } }
public static ushort GetUShortHash(string input, bool cache = false) { if (cache && ushortCachedHashes.ContainsKey(input)) { return(ushortCachedHashes[input]); } //using (SHA256Managed sha = new SHA256Managed()) //{ //byte[] hash = sha.ComputeHash(Encoding.UTF8.GetBytes(input)); ushort value = MessageDigest.SHA1_Opt(Encoding.UTF8.GetBytes(input)).CastUShort(); //(ushort)(hash[0] | (ushort)(hash[1] << 8)); if (cache) { ushortCachedHashes.Add(input, value); } return(value); //} }
public static ulong GetUIntHash(string input, bool cache = false) { if (cache && uintCachedHashes.ContainsKey(input)) { return(uintCachedHashes[input]); } //using (SHA256Managed sha = new SHA256Managed()) //{ //byte[] hash = sha.ComputeHash(Encoding.UTF8.GetBytes(input)); uint value = MessageDigest.SHA1_Opt(Encoding.UTF8.GetBytes(input)).CastUInt(); //hash[0] | ((uint)hash[1] << 8) | ((uint)hash[2] << 16) | ((uint)hash[3] << 24); if (cache) { uintCachedHashes.Add(input, value); } return(value); //} }
/// <summary> /// Static factory to retrieve a type 3 (name based) {@code UUID} based on /// the specified byte array. /// </summary> /// <param name="name"> /// A byte array to be used to construct a {@code UUID} /// </param> /// <returns> A {@code UUID} generated from the specified array </returns> public static UUID NameUUIDFromBytes(sbyte[] name) { MessageDigest md; try { md = MessageDigest.GetInstance("MD5"); } catch (NoSuchAlgorithmException nsae) { throw new InternalError("MD5 not supported", nsae); } sbyte[] md5Bytes = md.Digest(name); md5Bytes[6] &= 0x0f; // clear version md5Bytes[6] |= 0x30; // set to version 3 md5Bytes[8] &= 0x3f; // clear variant md5Bytes[8] |= unchecked ((sbyte)0x80); // set to IETF variant return(new UUID(md5Bytes)); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; // Create callback manager using CallbackManagerFactory CallbackManager = CallbackManagerFactory.Create(); CachedImageRenderer.Init(enableFastRenderer: true); base.OnCreate(savedInstanceState); CachedImageRenderer.Init(enableFastRenderer: true); global::Xamarin.Forms.Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental"); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); Xamarin.FormsMaps.Init(this, savedInstanceState); Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState); //LoadApplication(new App(Services.SharedInstance)); try { PackageInfo info = PackageManager.GetPackageInfo( "com.companyname.App1", PackageInfoFlags.Signatures); foreach (var signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); Log.Debug("KeyHash:", Base64.EncodeToString(md.Digest(), Base64.Default)); var s = Base64.EncodeToString(md.Digest(), Base64.Default); } } catch (NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { } LoadApplication(new App()); }
/// <exception cref="System.IO.IOException"></exception> private byte[] ComputeHash(InputStream @in, long length) { MessageDigest contentDigest = state.contentDigest; byte[] contentReadBuffer = state.contentReadBuffer; contentDigest.Reset(); contentDigest.Update(hblob); contentDigest.Update(unchecked ((byte)' ')); long sz = length; if (sz == 0) { contentDigest.Update(unchecked ((byte)'0')); } else { int bufn = contentReadBuffer.Length; int p = bufn; do { contentReadBuffer[--p] = digits[(int)(sz % 10)]; sz /= 10; }while (sz > 0); contentDigest.Update(contentReadBuffer, p, bufn - p); } contentDigest.Update(unchecked ((byte)0)); for (; ;) { int r = @in.Read(contentReadBuffer); if (r <= 0) { break; } contentDigest.Update(contentReadBuffer, 0, r); sz += r; } if (sz != length) { return(zeroid); } return(contentDigest.Digest()); }
public static string TDHexSHA1Digest(IEnumerable <Byte> input) { MessageDigest md; try { md = MessageDigest.GetInstance("SHA-1"); } catch (NoSuchAlgorithmException) { Log.E(Database.Tag, "Error, SHA-1 digest is unavailable."); return(null); } byte[] sha1hash; var inputArray = input.ToArray(); md.Update(inputArray, 0, inputArray.Length); sha1hash = md.Digest(); return(ConvertToHex(sha1hash)); }
public static BlobKey KeyForBlob(byte[] data) { MessageDigest md; try { md = MessageDigest.GetInstance("SHA-1"); } catch (NoSuchAlgorithmException) { Log.E(Database.Tag, "Error, SHA-1 digest is unavailable."); return(null); } byte[] sha1hash = new byte[40]; md.Update(data, 0, data.Length); sha1hash = md.Digest(); BlobKey result = new BlobKey(sha1hash); return(result); }
public static string HashString(string text, Encoding encoding) { if (string.IsNullOrEmpty(text)) { return(text); } MessageDigest md = MessageDigest.GetInstance("SHA-256"); md.Update(encoding.GetBytes(text)); byte[] digest = md.Digest(); StringBuilder hashString = new StringBuilder(); foreach (var @byte in digest) { hashString.Append(@byte.ToString("x2")); } return(hashString.ToString()); }
private void GetPackageInfoAndHashKey() { PackageInfo info = this.PackageManager.GetPackageInfo(PACKAGENAME, PackageInfoFlags.Signatures); foreach (Android.Content.PM.Signature signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); string keyhash = Convert.ToBase64String(md.Digest()); keyValueCacheUtility.GetUserDefaultsKeyValue("KeyHashString", keyhash); Console.WriteLine("KeyHash: {0}", keyhash); } if (!string.IsNullOrEmpty(info.VersionName)) { keyValueCacheUtility.GetUserDefaultsKeyValue("AppCurrentVersion", info.VersionName); } }
private void InitializeDigest() { if (_contentDigest != null) { return; } if (Parent == null) { _contentReadBuffer = new byte[BufferSize]; _contentDigest = Constants.newMessageDigest(); } else { var p = (WorkingTreeIterator)Parent; p.InitializeDigest(); _contentReadBuffer = p._contentReadBuffer; _contentDigest = p._contentDigest; } }
public override string CalculateSHA1() { MessageDigest md = MessageDigest.getInstance("SHA"); DataBufferInt dbi = (DataBufferInt)Image.getRaster().getDataBuffer(); for (int i = 0; i < dbi.getNumBanks(); i++) { int [] curBank = dbi.getData(i); for (int j = 0; j < curBank.Length; j++) { int x = curBank[j]; md.update((sbyte)(x & 0xFF)); md.update((sbyte)((x >> 8) & 0xFF)); md.update((sbyte)((x >> 16) & 0xFF)); md.update((sbyte)((x >> 24) & 0xFF)); } } byte [] resdata = (byte[])vmw.common.TypeUtils.ToByteArray(md.digest()); return(Convert.ToBase64String(resdata)); }
// Z:\jsc.svn\examples\javascript\crypto\test\TestWebServiceRSA\TestWebServiceRSA\Program.cs // X:\jsc.svn\examples\javascript\async\AsyncWorkerSourceSHA1\AsyncWorkerSourceSHA1\Application.cs // jsc, did we not do sha1 implementation for js? public override byte[] InternalComputeHash(byte[] buffer) { var value = default(byte[]); try { // http://mindprod.com/jgloss/sha1.html var a = MessageDigest.getInstance("SHA"); a.update(__File.InternalByteArrayToSByteArray(buffer)); value = __File.InternalSByteArrayToByteArray(a.digest()); } catch { throw; } return(value); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); core = new LoginCore(); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Facebook mprofileTracker = new MyProfileTracker(); mprofileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mprofileTracker.StartTracking(); BtnFBLogin = FindViewById <LoginButton>(Resource.Id.fblogin); BtnFBLogin.SetReadPermissions(new List <string> { "user_friends", "public_profile", "email" }); mFBCallManager = CallbackManagerFactory.Create(); BtnFBLogin.RegisterCallback(mFBCallManager, this); //Crear Cuenta crear_cuenta = FindViewById <Button>(Resource.Id.crear_cuenta); crear_cuenta.Click += delegate { Crear_cuenta(); }; //iniciar sesion iniciar_sesion = FindViewById <Button>(Resource.Id.iniciar_sesion); iniciar_sesion.Click += delegate { Iniciar_sesion(); }; //Hash PackageInfo info = this.PackageManager.GetPackageInfo("com.smartapptech.Boss_Mandados", PackageInfoFlags.Signatures); foreach (Android.Content.PM.Signature signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); string keyhash = Convert.ToBase64String(md.Digest()); Console.WriteLine("Keyhash: " + keyhash); } }
/// <summary>A helper class to sha1 hash all the strings in a collection</summary> /// <param name="nquads"></param> /// <returns></returns> private static string Sha1hash(ICollection <string> nquads) { #if !PORTABLE try { // create SHA-1 digest MessageDigest md = MessageDigest.GetInstance("SHA-1"); foreach (string nquad in nquads) { md.Update(JsonLD.JavaCompat.GetBytesForString(nquad, "UTF-8")); } return(EncodeHex(md.Digest())); } catch { throw; } #else throw new PlatformNotSupportedException(); #endif }
protected internal static int digest(TPointer inAddr, int inSize, TPointer outAddr, string algorithm, int hashLength) { sbyte[] input = inAddr.getArray8(inSize); sbyte[] hash = null; try { MessageDigest md = MessageDigest.getInstance(algorithm); hash = md.digest(input); } catch (Exception e) { // Ignore... Console.WriteLine(string.Format("SceKernelUtilsContext({0}).digest", algorithm), e); } if (hash != null) { outAddr.setArray(hash, hashLength); } return(0); }
/// <summary>A helper class to sha1 hash all the strings in a collection</summary> /// <param name="nquads"></param> /// <returns></returns> private static string Sha1hash(ICollection <string> nquads) { try { // create SHA-1 digest MessageDigest md = MessageDigest.GetInstance("SHA-1"); foreach (string nquad in nquads) { md.Update(JsonLD.JavaCompat.GetBytesForString(nquad, "UTF-8")); } return(EncodeHex(md.Digest())); } //catch (NoSuchAlgorithmException e) //{ // throw new Exception(e); //} catch { throw; } }
public BlobStoreWriter(BlobStore store) { this.store = store; try { sha1Digest = MessageDigest.GetInstance("SHA-1"); sha1Digest.Reset(); md5Digest = MessageDigest.GetInstance("MD5"); md5Digest.Reset(); } catch (NotSupportedException e) { throw Misc.CreateExceptionAndLog(Log.To.Database, e, Tag, "Could not get an instance of SHA-1 or MD5 for BlobStoreWriter."); } try { OpenTempFile(); } catch (FileNotFoundException e) { throw Misc.CreateExceptionAndLog(Log.To.Database, e, Tag, "Unable to open temporary file for BlobStoreWriter."); } }
/// <summary>Compute the name of an object, without inserting it.</summary> /// <remarks>Compute the name of an object, without inserting it.</remarks> /// <param name="objectType">type code of the object to store.</param> /// <param name="length"> /// number of bytes to scan from /// <code>in</code> /// . /// </param> /// <param name="in"> /// stream providing the object content. The caller is responsible /// for closing the stream. /// </param> /// <returns>the name of the object.</returns> /// <exception cref="System.IO.IOException">the source stream could not be read.</exception> public virtual ObjectId IdFor(int objectType, long length, InputStream @in) { MessageDigest md = Digest(); md.Update(Constants.EncodedTypeString(objectType)); md.Update(unchecked ((byte)' ')); md.Update(Constants.EncodeASCII(length)); md.Update(unchecked ((byte)0)); byte[] buf = Buffer(); while (length > 0) { int n = @in.Read(buf, 0, (int)Math.Min(length, buf.Length)); if (n < 0) { throw new EOFException("Unexpected end of input"); } md.Update(buf, 0, n); length -= n; } return(ObjectId.FromRaw(md.Digest())); }
private void GetHash() { try { PackageInfo info = PackageManager.GetPackageInfo("com.chatclube", PackageInfoFlags.Signatures); foreach (var signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); var sign = Base64.EncodeToString(md.Digest(), Base64.Default); Log.Info("MY KEY HASH:", sign); Toast.MakeText(ApplicationContext, sign, ToastLength.Long).Show(); } } catch (Android.Content.PM.PackageManager.NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { } }
/** * Gets the fingerprint of the signed certificate of a package. */ public static string GetFingerprint(Context context, string packageName) { var pm = context.PackageManager; var packageInfo = pm.GetPackageInfo(packageName, PackageInfoFlags.Signatures); var signatures = packageInfo.Signatures; if (signatures.Count != 1) { throw new SecurityException(packageName + " has " + signatures.Count + " signatures"); } var cert = signatures[0].ToByteArray(); using (Stream input = new MemoryStream(cert)) { var factory = CertificateFactory.GetInstance("X509"); var x509 = (X509Certificate)factory.GenerateCertificate(input); var md = MessageDigest.GetInstance("SHA256"); var publicKey = md.Digest(x509.GetEncoded()); return(ToHexFormat(publicKey)); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: static byte[] encryptPasswordSHA(byte[] userID, byte[] password, byte[] clientSeed, byte[] serverSeed) throws java.io.IOException internal static sbyte[] encryptPasswordSHA(sbyte[] userID, sbyte[] password, sbyte[] clientSeed, sbyte[] serverSeed) { try { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(userID); md.update(password); sbyte[] token = md.digest(); md.update(token); md.update(serverSeed); md.update(clientSeed); md.update(userID); md.update(SHA_SEQUENCE); return(md.digest()); } catch (NoSuchAlgorithmException e) { IOException io = new IOException("Error loading SHA encryption: " + e); io.initCause(e); throw io; } }
private static void PrintSignature() { try { PackageInfo info = Android.App.Application.Context.PackageManager.GetPackageInfo(Android.App.Application.Context.PackageName, PackageInfoFlags.Signatures); foreach (var signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); System.Diagnostics.Debug.WriteLine("---------------------Digest---------------------------"); System.Diagnostics.Debug.WriteLine(Convert.ToBase64String(md.Digest())); } } catch (NoSuchAlgorithmException e) { System.Diagnostics.Debug.WriteLine(e); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); } }
public static void PrintHashKey(Context pContext) { try { PackageInfo info = Android.App.Application.Context.PackageManager.GetPackageInfo(Android.App.Application.Context.PackageName, PackageInfoFlags.Signatures); foreach (var signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); System.Diagnostics.Debug.WriteLine("HelloWorld"); System.Diagnostics.Debug.WriteLine(BitConverter.ToString(md.Digest()).Replace("-", ":")); } } catch (NoSuchAlgorithmException e) { System.Diagnostics.Debug.WriteLine(e); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //for facebook FacebookSdk.SdkInitialize(this.ApplicationContext); SetContentView(Resource.Layout.LoginView); try { PackageInfo info = this.PackageManager.GetPackageInfo("natrix.NTM.droid", PackageInfoFlags.Signatures); foreach (Android.Content.PM.Signature signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); string keyhash = Convert.ToBase64String(md.Digest()); Console.WriteLine("keyhash:", keyhash); } } catch (PackageManager.NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { } mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += OnProfileChanged; mProfileTracker.StartTracking(); //for google GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn) .RequestEmail() .Build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .EnableAutoManage(this, this) .AddApi(Auth.GOOGLE_SIGN_IN_API, gso) .Build(); SetUI(); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); GoogleClientManager.Initialize(this); FacebookClientManager.Initialize(this); global::Xamarin.Forms.Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental"); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); //global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, savedInstanceState); /* This is for getting the KeyStore ID */ try { PackageInfo info = Android.App.Application.Context.PackageManager.GetPackageInfo(Android.App.Application.Context.PackageName, PackageInfoFlags.Signatures); foreach (var signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); var output = Convert.ToBase64String(md.Digest()); System.Diagnostics.Debug.WriteLine(output); } } catch (NoSuchAlgorithmException e) { System.Diagnostics.Debug.WriteLine(e); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); } LoadApplication(new App()); }
public static string Calculate(IDictionary <string, string> components) { MessageDigest ha1md5 = MessageDigest.GetInstance("md5"); MessageDigest ha2md5 = MessageDigest.GetInstance("md5"); MessageDigest responsemd5 = MessageDigest.GetInstance("md5"); var ha1Str = String.Format("{0}:{1}:{2}", components.Get("username"), components.Get("realm"), components.Get("password")); ha1md5.Update(Encoding.UTF8.GetBytes(ha1Str)); var ha1 = BitConverter.ToString(ha1md5.Digest()).Replace("-", "").ToLowerInvariant(); var ha2Str = String.Format("{0}:{1}", components.Get("method"), components.Get("uri")); ha2md5.Update(Encoding.UTF8.GetBytes(ha2Str)); var ha2 = BitConverter.ToString(ha2md5.Digest()).Replace("-", "").ToLowerInvariant(); var responseStr = String.Format("{0}:{1}:{2}:{3}:{4}:{5}", ha1, components.Get("nonce"), components.Get("nc"), components.Get("cnonce"), components.Get("qop"), ha2); responsemd5.Update(Encoding.UTF8.GetBytes(responseStr)); return(BitConverter.ToString(responsemd5.Digest()).Replace("-", "").ToLowerInvariant()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); PackageInfo info = this.PackageManager.GetPackageInfo("LoginRegister.LoginRegister", PackageInfoFlags.Signatures); foreach (Android.Content.PM.Signature signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); string keyhash = Convert.ToBase64String(md.Digest()); Console.WriteLine("etwwt", keyhash); } var button = FindViewById <Button>(Resource.Id.Register_clicked); button.Click += OnRegister_Clicked; var socialButton = FindViewById <Button>(Resource.Id.button2); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); ActivityContext = this; FacebookClientManager.Initialize(this); Xamarin.Essentials.Platform.Init(this, savedInstanceState); Rg.Plugins.Popup.Popup.Init(this, savedInstanceState); Xamarin.FormsMaps.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); AiForms.Dialogs.Dialogs.Init(this); LoadApplication(new App()); try { PackageInfo info = Android.App.Application.Context.PackageManager.GetPackageInfo(Android.App.Application.Context.PackageName, PackageInfoFlags.Signatures); foreach (var signature in info.Signatures) { MessageDigest md = MessageDigest.GetInstance("SHA"); md.Update(signature.ToByteArray()); string shahuella = Convert.ToBase64String(md.Digest()); System.Diagnostics.Debug.WriteLine(Convert.ToBase64String(md.Digest())); } } catch (NoSuchAlgorithmException e) { System.Diagnostics.Debug.WriteLine(e); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); } }
public BlobStoreWriter(BlobStore store) { this.store = store; try { sha1Digest = MessageDigest.GetInstance("SHA-1"); sha1Digest.Reset(); md5Digest = MessageDigest.GetInstance("MD5"); md5Digest.Reset(); } catch (NoSuchAlgorithmException e) { throw new InvalidOperationException(e); } try { OpenTempFile(); } catch (FileNotFoundException e) { throw new InvalidOperationException(e); } }
private void VerifySignatureHash(List <X509Certificate2> certs) { bool validSignatureFound = false; foreach (var signerCert in certs) { MessageDigest messageDigest = MessageDigest.GetInstance("SHA"); messageDigest.Update(signerCert.RawData); // Check the hash for signer cert is the same as what we hardcoded. string signatureHash = Base64.EncodeToString(messageDigest.Digest(), Base64Flags.NoWrap); if (BrokerTag.Equals(signatureHash, StringComparison.OrdinalIgnoreCase) || BrokerConstants.AzureAuthenticatorAppSignature.Equals(signatureHash, StringComparison.OrdinalIgnoreCase)) { validSignatureFound = true; } } if (!validSignatureFound) { throw new MsalClientException(MsalError.AndroidBrokerSignatureVerificationFailed, "No matching signature found"); } }
public BlobStoreWriter(BlobStore store) { this.store = store; try { sha1Digest = MessageDigest.GetInstance("SHA-1"); sha1Digest.Reset(); md5Digest = MessageDigest.GetInstance("MD5"); md5Digest.Reset(); } catch (NoSuchAlgorithmException e) { throw new InvalidOperationException("Could not get an instance of SHA-1 or MD5." , e); } try { OpenTempFile(); } catch (FileNotFoundException e) { throw new InvalidOperationException("Unable to open temporary file.", e); } }
/// <summary> /// Initializes a new instance of the <see cref="JavaCryptographicHash"/> class. /// </summary> /// <param name="algorithm">The algorithm.</param> internal JavaCryptographicHash(MessageDigest algorithm) { Requires.NotNull(algorithm, "algorithm"); this.Algorithm = algorithm; }
internal bool HashPasswordToDigest(string user, MessageDigest digest) { return IteratePassword(user, b => { digest.Update(b); return true; }); }