Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Permissions / StrongNamePublicKeyBlob.cs / 1305376 / StrongNamePublicKeyBlob.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // StrongNamePublicKeyBlob.cs // //[....] // namespace System.Security.Permissions { using System; using System.Security.Util; using System.Diagnostics.Contracts; [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" ); Contract.EndContractBlock(); 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. // // ==--== // StrongNamePublicKeyBlob.cs // //[....] // namespace System.Security.Permissions { using System; using System.Security.Util; using System.Diagnostics.Contracts; [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" ); Contract.EndContractBlock(); 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SafeRightsManagementEnvironmentHandle.cs
- BufferBuilder.cs
- SmiMetaDataProperty.cs
- DiagnosticSection.cs
- DataPagerFieldCommandEventArgs.cs
- ProxyHelper.cs
- WebResponse.cs
- SortKey.cs
- ResourceReader.cs
- WebPartMinimizeVerb.cs
- NotFiniteNumberException.cs
- ConnectionStringsExpressionBuilder.cs
- SimplePropertyEntry.cs
- SystemBrushes.cs
- XhtmlStyleClass.cs
- TableItemStyle.cs
- DataGridViewComponentPropertyGridSite.cs
- TextEditorSpelling.cs
- InputScopeAttribute.cs
- ResourceReader.cs
- GroupByQueryOperator.cs
- ACL.cs
- BooleanAnimationBase.cs
- TreeViewAutomationPeer.cs
- ScriptingSectionGroup.cs
- RegexGroupCollection.cs
- AdRotator.cs
- DeclarativeConditionsCollection.cs
- TableRow.cs
- DataGridViewHeaderCell.cs
- GlobalEventManager.cs
- FastPropertyAccessor.cs
- XmlIlGenerator.cs
- EventsTab.cs
- RevocationPoint.cs
- UxThemeWrapper.cs
- FlowLayoutSettings.cs
- Error.cs
- __Filters.cs
- FirstMatchCodeGroup.cs
- FontCacheUtil.cs
- DataBindingHandlerAttribute.cs
- SafeProcessHandle.cs
- SkipQueryOptionExpression.cs
- InstanceDescriptor.cs
- InsufficientMemoryException.cs
- FontFamilyConverter.cs
- ParameterModifier.cs
- DefaultPropertyAttribute.cs
- TraceHandlerErrorFormatter.cs
- BreadCrumbTextConverter.cs
- DataGridViewCell.cs
- RijndaelManaged.cs
- DiscardableAttribute.cs
- ByteConverter.cs
- MetafileHeaderEmf.cs
- FloaterParagraph.cs
- XmlByteStreamReader.cs
- IsolatedStorage.cs
- SecurityTokenParametersEnumerable.cs
- ListDictionaryInternal.cs
- InternalsVisibleToAttribute.cs
- ArgumentValue.cs
- DependencyPropertyChangedEventArgs.cs
- WeakReferenceEnumerator.cs
- HttpModuleCollection.cs
- DataGridTextColumn.cs
- IUnknownConstantAttribute.cs
- DbLambda.cs
- ScrollContentPresenter.cs
- HtmlInputRadioButton.cs
- Vertex.cs
- CodeMethodInvokeExpression.cs
- Region.cs
- _AcceptOverlappedAsyncResult.cs
- CellRelation.cs
- FormViewRow.cs
- DataGridViewColumnCollection.cs
- InternalBufferOverflowException.cs
- SuppressIldasmAttribute.cs
- AsymmetricKeyExchangeDeformatter.cs
- httpapplicationstate.cs
- NumberSubstitution.cs
- RecordBuilder.cs
- ResourceKey.cs
- XmlDeclaration.cs
- PermissionSetEnumerator.cs
- KnownColorTable.cs
- PerformanceCounterManager.cs
- SchemaConstraints.cs
- XmlNullResolver.cs
- ExtenderControl.cs
- ColorDialog.cs
- ReceiveMessageRecord.cs
- SerialReceived.cs
- ControlLocalizer.cs
- CommonObjectSecurity.cs
- NativeObjectSecurity.cs
- AnimationTimeline.cs
- MouseCaptureWithinProperty.cs