Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ObjectStateEntry.cs
- bidPrivateBase.cs
- regiisutil.cs
- UInt16.cs
- StylusPointPropertyInfo.cs
- FontInfo.cs
- TraceSection.cs
- SimpleLine.cs
- SystemIcmpV4Statistics.cs
- GPPOINTF.cs
- LabelLiteral.cs
- DependencyObjectType.cs
- TemplateKeyConverter.cs
- FilteredSchemaElementLookUpTable.cs
- SHA1Cng.cs
- UTF8Encoding.cs
- XsltException.cs
- MemberAccessException.cs
- RegexRunner.cs
- SchemaInfo.cs
- SafeMILHandleMemoryPressure.cs
- Camera.cs
- UserMapPath.cs
- XamlReader.cs
- BaseTreeIterator.cs
- CallbackException.cs
- CompositeCollection.cs
- InheritanceService.cs
- ChildTable.cs
- QualifiedCellIdBoolean.cs
- ComponentCollection.cs
- CqlIdentifiers.cs
- DataGridCheckBoxColumn.cs
- EdmError.cs
- DBAsyncResult.cs
- DrawingServices.cs
- Menu.cs
- ArrayTypeMismatchException.cs
- WeakReferenceEnumerator.cs
- DbProviderConfigurationHandler.cs
- ComEventsHelper.cs
- DateTimeFormatInfoScanner.cs
- DataComponentNameHandler.cs
- Win32.cs
- PrtCap_Public_Simple.cs
- bidPrivateBase.cs
- FamilyTypefaceCollection.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- DataGridViewAutoSizeModeEventArgs.cs
- sortedlist.cs
- SchemaAttDef.cs
- BitmapEffectvisualstate.cs
- ItemsControlAutomationPeer.cs
- MsmqDiagnostics.cs
- Parameter.cs
- ListViewInsertionMark.cs
- SettingsPropertyCollection.cs
- EnumerableCollectionView.cs
- ApplicationFileCodeDomTreeGenerator.cs
- PageAction.cs
- ComponentManagerBroker.cs
- DirectionalLight.cs
- ProfessionalColors.cs
- TimeSpanStorage.cs
- TypeConverterHelper.cs
- BitVector32.cs
- ToolStripSplitStackLayout.cs
- WorkerRequest.cs
- X509AudioLogo.cs
- Knowncolors.cs
- TypedLocationWrapper.cs
- InputLanguageProfileNotifySink.cs
- AudioStateChangedEventArgs.cs
- EntityDescriptor.cs
- MenuAutomationPeer.cs
- ContainerControl.cs
- ManagementEventWatcher.cs
- ScriptDescriptor.cs
- VBCodeProvider.cs
- EntityModelSchemaGenerator.cs
- ComponentEditorPage.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- XhtmlBasicSelectionListAdapter.cs
- SettingsAttributeDictionary.cs
- InputLanguageManager.cs
- Rect3D.cs
- ObjectStateEntryDbDataRecord.cs
- FamilyTypefaceCollection.cs
- FileUtil.cs
- CommonDialog.cs
- ContextProperty.cs
- DetailsViewUpdateEventArgs.cs
- SystemIPv4InterfaceProperties.cs
- IProducerConsumerCollection.cs
- ObjectParameter.cs
- ApplicationDirectory.cs
- AddingNewEventArgs.cs
- ThreadStaticAttribute.cs
- KeyBinding.cs
- CaretElement.cs