3 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
5 // Permission is hereby granted, free of charge, to any person obtaining
6 // a copy of this software and associated documentation files (the
7 // "Software"), to deal in the Software without restriction, including
8 // without limitation the rights to use, copy, modify, merge, publish,
9 // distribute, sublicense, and/or sell copies of the Software, and to
10 // permit persons to whom the Software is furnished to do so, subject to
11 // the following conditions:
13 // The above copyright notice and this permission notice shall be
14 // included in all copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 // Implementation of the
29 // System.Configuration.Assemblies.AssemblyHash
30 // class for the Mono Class Library
33 // Tomas Restrepo (tomasr@mvps.org)
36 namespace System
.Configuration
.Assemblies
{
39 public struct AssemblyHash
: System
.ICloneable
41 private AssemblyHashAlgorithm _algorithm
;
42 private byte[] _value
;
44 public static readonly AssemblyHash Empty
=
45 new AssemblyHash(AssemblyHashAlgorithm
.None
,null);
51 public AssemblyHashAlgorithm Algorithm
{
52 get { return _algorithm; }
53 set { _algorithm = value; }
60 public AssemblyHash ( AssemblyHashAlgorithm algorithm
, byte[] value )
62 _algorithm
= algorithm
;
66 int size
= value.Length
;
67 _value
= new byte[size
];
68 System
.Array
.Copy ( value, _value
, size
);
72 public AssemblyHash ( byte[] value )
73 : this(AssemblyHashAlgorithm
.SHA1
, value)
79 return new AssemblyHash(_algorithm
,_value
);
82 public byte[] GetValue()
86 public void SetValue ( byte[] value )
91 } // class AssemblyHash
93 } // namespace System.Configuration.Assemblies