hyperledger-archives / ursa

Hyperledger Ursa (a shared cryptographic library) has moved to end-of-life status, with the components of Ursa still in use moved to their relevant Hyperledger projects (AnonCreds, Indy, Aries and Iroha).
https://wiki.hyperledger.org/display/ursa
Apache License 2.0
321 stars 142 forks source link

Cleanup #211

Closed berendsliedrecht closed 2 years ago

berendsliedrecht commented 2 years ago

Noticed that there were quite some unnecessary references and small things that could be refactored. If these references and other choices are by-design This PR can be closed and ignored.

It does not alter the functionality one bit except for what seemd to me as an issue in to_bytes on the Sharing struct.

from:

    pub fn to_bytes(&self) -> Vec<u8> {
         let mut o = self.identifier.to_be_bytes().to_vec();
         o.append(&mut self.to_bytes()); // This recusively calls itself and should never return?
         o
     }

to:

    pub fn to_bytes(&mut self) -> Vec<u8> {
         let mut o = self.identifier.to_be_bytes().to_vec();
         o.append(&mut self.value);
         o
     }