Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Security / Permissions / StrongNamePublicKeyBlob.cs / 1 / StrongNamePublicKeyBlob.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // StrongNamePublicKeyBlob.cs // namespace System.Security.Permissions { using System; using SecurityElement = System.Security.SecurityElement; using System.Security.Util; [System.Runtime.InteropServices.ComVisible(true)] [Serializable] sealed public class StrongNamePublicKeyBlob { internal byte[] PublicKey; internal StrongNamePublicKeyBlob() { } public StrongNamePublicKeyBlob( byte[] publicKey ) { if (publicKey == null) throw new ArgumentNullException( "PublicKey" ); this.PublicKey = new byte[publicKey.Length]; Array.Copy( publicKey, 0, this.PublicKey, 0, publicKey.Length ); } internal StrongNamePublicKeyBlob( String publicKey ) { this.PublicKey = Hex.DecodeHexString( publicKey ); } private static bool CompareArrays( byte[] first, byte[] second ) { if (first.Length != second.Length) { return false; } int count = first.Length; for (int i = 0; i < count; ++i) { if (first[i] != second[i]) return false; } return true; } internal bool Equals( StrongNamePublicKeyBlob blob ) { if (blob == null) return false; else return CompareArrays( this.PublicKey, blob.PublicKey ); } public override bool Equals( Object obj ) { if (obj == null || !(obj is StrongNamePublicKeyBlob)) return false; return this.Equals( (StrongNamePublicKeyBlob)obj ); } static private int GetByteArrayHashCode( byte[] baData ) { if (baData == null) return 0; int accumulator = 0; for (int i = 0; i < baData.Length; ++i) { accumulator = (accumulator << 8) ^ (int)baData[i] ^ (accumulator >> 24); } return accumulator; } public override int GetHashCode() { return GetByteArrayHashCode( PublicKey ); } public override String ToString() { return Hex.EncodeHexString( PublicKey ); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FormClosedEvent.cs
- XmlTextAttribute.cs
- AssemblyName.cs
- DataSourceListEditor.cs
- ReadOnlyCollectionBase.cs
- PowerStatus.cs
- JsonMessageEncoderFactory.cs
- WebBrowser.cs
- MethodBody.cs
- SqlDataRecord.cs
- WebBrowsableAttribute.cs
- StylusPlugInCollection.cs
- RegexNode.cs
- StylusOverProperty.cs
- XamlFilter.cs
- UIntPtr.cs
- PrtCap_Builder.cs
- ColorContextHelper.cs
- SlipBehavior.cs
- WorkflowServiceAttributesTypeConverter.cs
- GridViewColumnCollection.cs
- TextStore.cs
- DataControlCommands.cs
- DBCSCodePageEncoding.cs
- OrderPreservingPipeliningSpoolingTask.cs
- BuildResult.cs
- HttpAsyncResult.cs
- FixedPage.cs
- Barrier.cs
- UpdateCompiler.cs
- InputProcessorProfilesLoader.cs
- LinkedResource.cs
- ListViewGroup.cs
- ToolStripMenuItem.cs
- TdsParser.cs
- TextRangeProviderWrapper.cs
- TextAnchor.cs
- ToggleProviderWrapper.cs
- TextWriterTraceListener.cs
- PropertyCollection.cs
- newinstructionaction.cs
- TemplateKeyConverter.cs
- OutgoingWebRequestContext.cs
- WebPartDescription.cs
- ListSourceHelper.cs
- _SingleItemRequestCache.cs
- QueryCursorEventArgs.cs
- TimeoutException.cs
- XmlEntity.cs
- SafeProcessHandle.cs
- NumberFormatter.cs
- Currency.cs
- DictionaryContent.cs
- Cursors.cs
- MediaEntryAttribute.cs
- CodeSnippetTypeMember.cs
- XmlSchemaValidator.cs
- BStrWrapper.cs
- CheckedPointers.cs
- UserThread.cs
- BaseTemplateBuildProvider.cs
- EnglishPluralizationService.cs
- ConfigurationManagerInternalFactory.cs
- BordersPage.cs
- UnmanagedMemoryStream.cs
- PostBackOptions.cs
- XpsImageSerializationService.cs
- SendingRequestEventArgs.cs
- OleDbMetaDataFactory.cs
- ScriptIgnoreAttribute.cs
- IndentedWriter.cs
- ClusterRegistryConfigurationProvider.cs
- XmlHelper.cs
- DbConnectionPoolCounters.cs
- CurrencyManager.cs
- PrePrepareMethodAttribute.cs
- HtmlContainerControl.cs
- XmlIncludeAttribute.cs
- ContentAlignmentEditor.cs
- WebPartZoneCollection.cs
- RelationshipEndCollection.cs
- ModelChangedEventArgsImpl.cs
- PropertyItem.cs
- ConditionCollection.cs
- MailSettingsSection.cs
- FixedMaxHeap.cs
- SafeNativeMemoryHandle.cs
- RsaKeyIdentifierClause.cs
- CheckBoxStandardAdapter.cs
- EntityDataSourceWizardForm.cs
- Utilities.cs
- UnsafeNativeMethods.cs
- SHA1CryptoServiceProvider.cs
- HtmlInputHidden.cs
- ExpandedWrapper.cs
- PreloadHost.cs
- StreamResourceInfo.cs
- ContextMenuStripGroup.cs
- ArcSegment.cs
- SettingsPropertyValueCollection.cs