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
- HelpKeywordAttribute.cs
- HtmlControlPersistable.cs
- ClientClassGenerator.cs
- EventData.cs
- PageContent.cs
- WebPartDisplayMode.cs
- XmlQueryOutput.cs
- NamespaceQuery.cs
- EntityContainer.cs
- ImageAttributes.cs
- CategoryAttribute.cs
- EventRecordWrittenEventArgs.cs
- CodeChecksumPragma.cs
- TextBoxLine.cs
- _AutoWebProxyScriptEngine.cs
- WindowsAuthenticationEventArgs.cs
- XmlSchemaObjectCollection.cs
- DropTarget.cs
- StorageModelBuildProvider.cs
- XmlSchemaDatatype.cs
- PenThreadPool.cs
- BufferedWebEventProvider.cs
- ResourceDictionaryCollection.cs
- HtmlForm.cs
- QueryOutputWriter.cs
- x509store.cs
- CryptoApi.cs
- PointAnimation.cs
- TypeLibConverter.cs
- MaskedTextBoxTextEditorDropDown.cs
- EntityParameterCollection.cs
- SectionRecord.cs
- OutputCacheProfileCollection.cs
- IApplicationTrustManager.cs
- ToolBar.cs
- GZipDecoder.cs
- GeneratedCodeAttribute.cs
- ToolStrip.cs
- TraceEventCache.cs
- UriExt.cs
- FormsAuthenticationUserCollection.cs
- ListChunk.cs
- shaper.cs
- Activation.cs
- TextModifierScope.cs
- ProviderMetadata.cs
- MatrixUtil.cs
- SymmetricAlgorithm.cs
- PriorityBinding.cs
- DataServiceBuildProvider.cs
- DataServicePagingProviderWrapper.cs
- WmlValidatorAdapter.cs
- DBConnection.cs
- LinearGradientBrush.cs
- ObjectDataSourceStatusEventArgs.cs
- BoundingRectTracker.cs
- DropDownList.cs
- HelpExampleGenerator.cs
- TimersDescriptionAttribute.cs
- Timer.cs
- DeflateStream.cs
- uribuilder.cs
- SecurityPolicySection.cs
- FacetEnabledSchemaElement.cs
- XmlArrayItemAttribute.cs
- ListControl.cs
- RelationshipFixer.cs
- FixedDSBuilder.cs
- InvalidPipelineStoreException.cs
- SelectionEditor.cs
- WebPartDisplayMode.cs
- SHA512Managed.cs
- ApplicationDirectory.cs
- XsdValidatingReader.cs
- IdentitySection.cs
- SuppressIldasmAttribute.cs
- AuthorizationSection.cs
- Size.cs
- WebBrowsableAttribute.cs
- HttpEncoderUtility.cs
- HostUtils.cs
- ResourcePool.cs
- EventListener.cs
- RoleService.cs
- Hashtable.cs
- WindowHelperService.cs
- CacheVirtualItemsEvent.cs
- ErrorStyle.cs
- IdentityReference.cs
- DataSourceExpressionCollection.cs
- SchemaImporterExtension.cs
- BindingExpressionBase.cs
- BufferedConnection.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- FlowLayoutSettings.cs
- OperationDescriptionCollection.cs
- Matrix.cs
- EmissiveMaterial.cs
- PerformanceCounterLib.cs
- FlowDocumentFormatter.cs