Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Cryptography / PKCS1MaskGenerationMethod.cs / 1305376 / 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
//
[System.Security.SecuritySafeCritical] // auto-generated
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
//
[System.Security.SecuritySafeCritical] // auto-generated
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
- SqlInternalConnection.cs
- TypeRefElement.cs
- PrimaryKeyTypeConverter.cs
- SubMenuStyle.cs
- InternalDispatchObject.cs
- SqlParameterizer.cs
- ExtensionSimplifierMarkupObject.cs
- DisplayNameAttribute.cs
- Run.cs
- ObjectSecurity.cs
- LinkGrep.cs
- EntityDataSourceReferenceGroup.cs
- ModelItemCollection.cs
- WindowsListView.cs
- ComponentDispatcherThread.cs
- HybridDictionary.cs
- AsymmetricKeyExchangeFormatter.cs
- KeyToListMap.cs
- NotSupportedException.cs
- Bitmap.cs
- SqlCacheDependencySection.cs
- IList.cs
- DataGridParentRows.cs
- ProviderConnectionPoint.cs
- GridViewCommandEventArgs.cs
- ProgramNode.cs
- GeometryHitTestResult.cs
- Helper.cs
- SmiTypedGetterSetter.cs
- QilXmlReader.cs
- WindowsComboBox.cs
- SqlCommandSet.cs
- InterleavedZipPartStream.cs
- PublishLicense.cs
- AssemblyResolver.cs
- IEnumerable.cs
- EpmContentSerializerBase.cs
- SqlOuterApplyReducer.cs
- WebConfigurationHost.cs
- UniqueIdentifierService.cs
- WebServiceMethodData.cs
- InternalConfigHost.cs
- XmlWrappingReader.cs
- WebUtil.cs
- DialogWindow.cs
- RequestCacheValidator.cs
- VSWCFServiceContractGenerator.cs
- ClientProxyGenerator.cs
- Int32RectConverter.cs
- HttpRequest.cs
- ProfessionalColorTable.cs
- ThrowHelper.cs
- HttpListenerRequestUriBuilder.cs
- DbConnectionPoolGroupProviderInfo.cs
- Point3D.cs
- SplineQuaternionKeyFrame.cs
- Debugger.cs
- GenericIdentity.cs
- WmlFormAdapter.cs
- NamespaceList.cs
- SizeLimitedCache.cs
- storepermissionattribute.cs
- TextParaLineResult.cs
- NamespaceExpr.cs
- BulletChrome.cs
- ReadOnlyDictionary.cs
- ArglessEventHandlerProxy.cs
- AudioFileOut.cs
- Serializer.cs
- RegularExpressionValidator.cs
- __FastResourceComparer.cs
- SpinLock.cs
- DataGridViewCellEventArgs.cs
- PointAnimationClockResource.cs
- ImageCodecInfoPrivate.cs
- HitTestWithPointDrawingContextWalker.cs
- Content.cs
- COSERVERINFO.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- HiddenField.cs
- dtdvalidator.cs
- SqlIdentifier.cs
- SQlBooleanStorage.cs
- EntryPointNotFoundException.cs
- X509Extension.cs
- Bits.cs
- InnerItemCollectionView.cs
- MultiDataTrigger.cs
- TextEffectResolver.cs
- ParameterModifier.cs
- CorrelationExtension.cs
- XmlEnumAttribute.cs
- InvokeSchedule.cs
- validationstate.cs
- FillErrorEventArgs.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- DeclarativeCatalogPart.cs
- ToolStripPanelRenderEventArgs.cs
- DataGridParentRows.cs
- Tokenizer.cs