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
- AgileSafeNativeMemoryHandle.cs
- StringDictionaryCodeDomSerializer.cs
- DataGridViewRowCancelEventArgs.cs
- PackageDigitalSignature.cs
- DbParameterHelper.cs
- SqlOuterApplyReducer.cs
- ExpressionDumper.cs
- SmtpFailedRecipientException.cs
- BrowserCapabilitiesFactoryBase.cs
- safemediahandle.cs
- FixedSOMTableRow.cs
- ServiceModelEnumValidatorAttribute.cs
- TransactionManager.cs
- ToolStripControlHost.cs
- Pen.cs
- EventLogTraceListener.cs
- XPathNodeIterator.cs
- MouseButton.cs
- FileChangesMonitor.cs
- TCPListener.cs
- KeyFrames.cs
- SharedConnectionInfo.cs
- CompilerGlobalScopeAttribute.cs
- CodePageUtils.cs
- GifBitmapEncoder.cs
- Storyboard.cs
- _CacheStreams.cs
- ProviderUtil.cs
- ActiveDesignSurfaceEvent.cs
- ValidationHelpers.cs
- KeyGesture.cs
- FontFaceLayoutInfo.cs
- DisplayNameAttribute.cs
- IndexedString.cs
- BufferedReadStream.cs
- LocatorPartList.cs
- DataSourceSelectArguments.cs
- ParenExpr.cs
- UserControlAutomationPeer.cs
- storepermissionattribute.cs
- ActiveXMessageFormatter.cs
- EntityClassGenerator.cs
- FontWeight.cs
- ExceptionUtil.cs
- ExtensionFile.cs
- DocumentXmlWriter.cs
- CreateParams.cs
- ExcCanonicalXml.cs
- FamilyMapCollection.cs
- AnnotationHelper.cs
- TypeToArgumentTypeConverter.cs
- ServerValidateEventArgs.cs
- CustomAttribute.cs
- RegisteredDisposeScript.cs
- Label.cs
- FormViewUpdatedEventArgs.cs
- XhtmlConformanceSection.cs
- RowsCopiedEventArgs.cs
- smtpconnection.cs
- UInt32Converter.cs
- HuffCodec.cs
- ScriptBehaviorDescriptor.cs
- UrlAuthorizationModule.cs
- SqlCommandAsyncResult.cs
- NotifyParentPropertyAttribute.cs
- SystemWebExtensionsSectionGroup.cs
- XPathSelfQuery.cs
- ByteKeyFrameCollection.cs
- HwndSubclass.cs
- SchemaNamespaceManager.cs
- RSAPKCS1KeyExchangeFormatter.cs
- DelegateTypeInfo.cs
- AssemblyBuilder.cs
- AppDomainProtocolHandler.cs
- InProcStateClientManager.cs
- Normalization.cs
- HtmlTableCell.cs
- DockAndAnchorLayout.cs
- ListViewInsertEventArgs.cs
- SafeSecurityHelper.cs
- MetafileHeaderEmf.cs
- TransformValueSerializer.cs
- WaitingCursor.cs
- _CacheStreams.cs
- TemplateXamlParser.cs
- Slider.cs
- HtmlTernaryTree.cs
- DecoderFallbackWithFailureFlag.cs
- DataGridViewAccessibleObject.cs
- DataExpression.cs
- DateTimeSerializationSection.cs
- SerializerDescriptor.cs
- XmlAtomicValue.cs
- HijriCalendar.cs
- Menu.cs
- SqlError.cs
- UInt64Converter.cs
- MethodToken.cs
- PictureBox.cs
- AssemblyAttributesGoHere.cs