Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97873799
FragmentPartial.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jan 7, 01:09
Size
1 KB
Mime Type
text/x-java
Expires
Thu, Jan 9, 01:09 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23424402
Attached To
R3229 Genome Privacy - SHCS App
FragmentPartial.java
View Options
package
crypto.elgamal
;
import
org.bouncycastle.math.ec.ECPoint
;
public
class
FragmentPartial
extends
FragmentEncrypted
{
private
ECPoint
T
;
private
int
partNumber
;
public
FragmentPartial
(
int
partNumber
,
FragmentEncrypted
encrypted
,
ECPoint
T
)
{
super
(
encrypted
.
getR
(),
encrypted
.
getS
());
if
(!
validPartNumber
(
partNumber
))
{
throw
new
IllegalArgumentException
(
"not a valid part number"
);
}
this
.
partNumber
=
partNumber
;
this
.
T
=
T
;
}
public
ECPoint
getT
()
{
return
T
;
}
public
int
getPartNumber
()
{
return
partNumber
;
}
private
boolean
validPartNumber
(
int
partNumber
)
{
switch
(
partNumber
)
{
case
ECElGamal
.
PART_SPU:
case
ECElGamal
.
PART_MU:
return
true
;
default
:
return
false
;
}
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
super
.
hashCode
();
result
=
prime
*
result
+
((
T
==
null
)
?
0
:
T
.
hashCode
());
result
=
prime
*
result
+
partNumber
;
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(!
super
.
equals
(
obj
))
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
FragmentPartial
other
=
(
FragmentPartial
)
obj
;
if
(
T
==
null
)
{
if
(
other
.
T
!=
null
)
return
false
;
}
else
if
(!
T
.
equals
(
other
.
T
))
return
false
;
if
(
partNumber
!=
other
.
partNumber
)
return
false
;
return
true
;
}
public
boolean
equalsFragmentEncrypted
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(!
super
.
equals
(
obj
))
return
false
;
return
true
;
}
}
Event Timeline
Log In to Comment