Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / Security / Cryptography / PKCS1MaskGenerationMethod.cs / 1 / PKCS1MaskGenerationMethod.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class PKCS1MaskGenerationMethod : MaskGenerationMethod { private String HashNameValue; // // public constructors // public PKCS1MaskGenerationMethod() { HashNameValue = "SHA1"; } // // public properties // public String HashName { get { return HashNameValue; } set { HashNameValue = value; if (HashNameValue == null) { HashNameValue = "SHA1"; } } } // // public methods // public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn) { HashAlgorithm hash = (HashAlgorithm) CryptoConfig.CreateFromName(HashNameValue); byte[] rgbCounter = new byte[4]; byte[] rgbT = new byte[cbReturn]; uint counter = 0; for (int ib=0; ib_hash.Length) { Buffer.BlockCopy(_hash, 0, rgbT, ib, _hash.Length); } else { Buffer.BlockCopy(_hash, 0, rgbT, ib, rgbT.Length - ib); } ib += hash.Hash.Length; } return rgbT; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class PKCS1MaskGenerationMethod : MaskGenerationMethod { private String HashNameValue; // // public constructors // public PKCS1MaskGenerationMethod() { HashNameValue = "SHA1"; } // // public properties // public String HashName { get { return HashNameValue; } set { HashNameValue = value; if (HashNameValue == null) { HashNameValue = "SHA1"; } } } // // public methods // public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn) { HashAlgorithm hash = (HashAlgorithm) CryptoConfig.CreateFromName(HashNameValue); byte[] rgbCounter = new byte[4]; byte[] rgbT = new byte[cbReturn]; uint counter = 0; for (int ib=0; ib _hash.Length) { Buffer.BlockCopy(_hash, 0, rgbT, ib, _hash.Length); } else { Buffer.BlockCopy(_hash, 0, rgbT, ib, rgbT.Length - ib); } ib += hash.Hash.Length; } return rgbT; } } } // 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
- XmlAttributeAttribute.cs
- ConfigurationValue.cs
- SerializationSectionGroup.cs
- SemanticAnalyzer.cs
- WsdlWriter.cs
- ImageDrawing.cs
- ToolStripArrowRenderEventArgs.cs
- StorageBasedPackageProperties.cs
- ErrorProvider.cs
- PropertyMap.cs
- RepeaterItem.cs
- DPTypeDescriptorContext.cs
- HtmlInputHidden.cs
- ExecutionEngineException.cs
- HWStack.cs
- DataSourceHelper.cs
- XsdBuilder.cs
- XmlObjectSerializerContext.cs
- XmlAttributeOverrides.cs
- SamlAttributeStatement.cs
- FilteredDataSetHelper.cs
- XmlSchemaRedefine.cs
- DataServiceSaveChangesEventArgs.cs
- DesignUtil.cs
- XmlUtilWriter.cs
- CodeMethodReturnStatement.cs
- SimpleApplicationHost.cs
- TemplatePropertyEntry.cs
- WindowsHyperlink.cs
- TraceListener.cs
- FactoryId.cs
- ProcessInfo.cs
- NativeMethods.cs
- OutputCacheProfileCollection.cs
- Rotation3DAnimation.cs
- TreeNodeCollectionEditorDialog.cs
- CollectionViewGroupInternal.cs
- TreeNodeEventArgs.cs
- ProgressPage.cs
- mediaeventshelper.cs
- XXXInfos.cs
- Item.cs
- BlockCollection.cs
- CodeVariableDeclarationStatement.cs
- SqlNamer.cs
- SqlNotificationEventArgs.cs
- HotCommands.cs
- PolyQuadraticBezierSegment.cs
- StaticExtensionConverter.cs
- ChineseLunisolarCalendar.cs
- HtmlPageAdapter.cs
- Normalization.cs
- ZoneButton.cs
- CfgParser.cs
- DataColumnChangeEvent.cs
- SemanticTag.cs
- GeneralTransform3DTo2D.cs
- Int16Converter.cs
- SecureUICommand.cs
- TextTreeExtractElementUndoUnit.cs
- BrowserDefinitionCollection.cs
- SR.cs
- GlobalProxySelection.cs
- AuthenticationConfig.cs
- SafeLocalAllocation.cs
- SerialPinChanges.cs
- UpdateCompiler.cs
- GridItemProviderWrapper.cs
- TcpClientCredentialType.cs
- ImageConverter.cs
- HttpVersion.cs
- ClientBuildManagerCallback.cs
- EntityReference.cs
- OdbcConnectionString.cs
- XmlSchemaSet.cs
- ToolStripSeparator.cs
- XmlReflectionImporter.cs
- GorillaCodec.cs
- ResourcesChangeInfo.cs
- MimeTypeMapper.cs
- DataSvcMapFile.cs
- ImageAutomationPeer.cs
- FixedSOMGroup.cs
- XmlHierarchicalDataSourceView.cs
- StyleSheet.cs
- KeyedHashAlgorithm.cs
- StateWorkerRequest.cs
- MemberPath.cs
- ObjectViewFactory.cs
- SqlParameter.cs
- HtmlShimManager.cs
- _NativeSSPI.cs
- ToolboxItemAttribute.cs
- ToolStripItemDesigner.cs
- ConfigurationHandlersInstallComponent.cs
- BaseValidator.cs
- ResourceManager.cs
- ServiceDesigner.cs
- OpenTypeLayoutCache.cs
- ExpressionEditorAttribute.cs