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
- PictureBox.cs
- KeyboardEventArgs.cs
- WindowsHyperlink.cs
- Properties.cs
- ActivityFunc.cs
- SocketPermission.cs
- FormsAuthenticationUserCollection.cs
- BuildProvidersCompiler.cs
- XPathNavigatorReader.cs
- ServiceObjectContainer.cs
- DirectoryObjectSecurity.cs
- BinaryObjectReader.cs
- DateTimeFormat.cs
- NamespaceMapping.cs
- ActivityCollectionMarkupSerializer.cs
- JournalEntry.cs
- ServiceSecurityAuditBehavior.cs
- ClientSettingsStore.cs
- newinstructionaction.cs
- TextParaLineResult.cs
- ItemsPresenter.cs
- UInt64Storage.cs
- DataGrid.cs
- MobileListItem.cs
- PeerTransportCredentialType.cs
- CatalogZone.cs
- ToolStripContentPanelDesigner.cs
- XmlSerializationReader.cs
- IDataContractSurrogate.cs
- XmlHierarchicalEnumerable.cs
- TextCompositionManager.cs
- ListViewInsertionMark.cs
- StylusPointDescription.cs
- PrinterResolution.cs
- Rfc2898DeriveBytes.cs
- HtmlFormWrapper.cs
- PreviewPrintController.cs
- ParentUndoUnit.cs
- ClientFormsAuthenticationCredentials.cs
- SchemaRegistration.cs
- CollectionChangeEventArgs.cs
- Color.cs
- MergeFilterQuery.cs
- _Semaphore.cs
- Rule.cs
- NumberFormatInfo.cs
- SyndicationElementExtension.cs
- StaticFileHandler.cs
- FileDialogPermission.cs
- GenericTypeParameterBuilder.cs
- CharAnimationBase.cs
- Matrix3DConverter.cs
- GridViewRowEventArgs.cs
- AttributeCollection.cs
- DataGridItemAutomationPeer.cs
- SqlTypeSystemProvider.cs
- IntegrationExceptionEventArgs.cs
- SqlAliaser.cs
- AutoGeneratedFieldProperties.cs
- RowVisual.cs
- _Win32.cs
- COM2FontConverter.cs
- TrustManager.cs
- ProcessHostServerConfig.cs
- ControlPaint.cs
- HandleCollector.cs
- TdsParser.cs
- ElementNotAvailableException.cs
- SrgsToken.cs
- Pen.cs
- DropDownList.cs
- Transform3D.cs
- IIS7WorkerRequest.cs
- Matrix3DStack.cs
- Int64AnimationBase.cs
- ReliableMessagingHelpers.cs
- HelpKeywordAttribute.cs
- EmbeddedObject.cs
- NaturalLanguageHyphenator.cs
- DataGridViewRowPrePaintEventArgs.cs
- Parameter.cs
- EdmFunctions.cs
- Section.cs
- WebConfigurationFileMap.cs
- Converter.cs
- DataBindingCollection.cs
- DataBindingCollection.cs
- XslNumber.cs
- ThreadAttributes.cs
- XamlFigureLengthSerializer.cs
- MethodBuilder.cs
- NonSerializedAttribute.cs
- BlockCollection.cs
- ComponentDispatcherThread.cs
- SupportsEventValidationAttribute.cs
- PathFigureCollection.cs
- SystemDropShadowChrome.cs
- ScriptingProfileServiceSection.cs
- SwitchAttribute.cs
- TemplateXamlParser.cs