1 // This file was automatically generated by protocompiler
3 // Compiled from OTAuthenticatedCiphertext.proto
5 #import "OTAuthenticatedCiphertext.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
10 #if !__has_feature(objc_arc)
11 # error This generated file depends on ARC but it is not enabled; turn on ARC, or use 'objc_use_arc' option to generate non-ARC code.
14 @implementation OTAuthenticatedCiphertext
16 @synthesize ciphertext = _ciphertext;
17 @synthesize authenticationCode = _authenticationCode;
18 @synthesize initializationVector = _initializationVector;
20 - (NSString *)description
22 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
25 - (NSDictionary *)dictionaryRepresentation
27 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
28 if (self->_ciphertext)
30 [dict setObject:self->_ciphertext forKey:@"ciphertext"];
32 if (self->_authenticationCode)
34 [dict setObject:self->_authenticationCode forKey:@"authenticationCode"];
36 if (self->_initializationVector)
38 [dict setObject:self->_initializationVector forKey:@"initializationVector"];
43 BOOL OTAuthenticatedCiphertextReadFrom(__unsafe_unretained OTAuthenticatedCiphertext *self, __unsafe_unretained PBDataReader *reader) {
44 while (PBReaderHasMoreData(reader)) {
48 PBReaderReadTag32AndType(reader, &tag, &aType);
50 if (PBReaderHasError(reader))
53 if (aType == TYPE_END_GROUP) {
59 case 1 /* ciphertext */:
61 NSData *new_ciphertext = PBReaderReadData(reader);
62 self->_ciphertext = new_ciphertext;
65 case 2 /* authenticationCode */:
67 NSData *new_authenticationCode = PBReaderReadData(reader);
68 self->_authenticationCode = new_authenticationCode;
71 case 3 /* initializationVector */:
73 NSData *new_initializationVector = PBReaderReadData(reader);
74 self->_initializationVector = new_initializationVector;
78 if (!PBReaderSkipValueWithTag(reader, tag, aType))
83 return !PBReaderHasError(reader);
86 - (BOOL)readFrom:(PBDataReader *)reader
88 return OTAuthenticatedCiphertextReadFrom(self, reader);
90 - (void)writeTo:(PBDataWriter *)writer
94 assert(nil != self->_ciphertext);
95 PBDataWriterWriteDataField(writer, self->_ciphertext, 1);
97 /* authenticationCode */
99 assert(nil != self->_authenticationCode);
100 PBDataWriterWriteDataField(writer, self->_authenticationCode, 2);
102 /* initializationVector */
104 assert(nil != self->_initializationVector);
105 PBDataWriterWriteDataField(writer, self->_initializationVector, 3);
109 - (void)copyTo:(OTAuthenticatedCiphertext *)other
111 other.ciphertext = _ciphertext;
112 other.authenticationCode = _authenticationCode;
113 other.initializationVector = _initializationVector;
116 - (id)copyWithZone:(NSZone *)zone
118 OTAuthenticatedCiphertext *copy = [[[self class] allocWithZone:zone] init];
119 copy->_ciphertext = [_ciphertext copyWithZone:zone];
120 copy->_authenticationCode = [_authenticationCode copyWithZone:zone];
121 copy->_initializationVector = [_initializationVector copyWithZone:zone];
125 - (BOOL)isEqual:(id)object
127 OTAuthenticatedCiphertext *other = (OTAuthenticatedCiphertext *)object;
128 return [other isMemberOfClass:[self class]]
130 ((!self->_ciphertext && !other->_ciphertext) || [self->_ciphertext isEqual:other->_ciphertext])
132 ((!self->_authenticationCode && !other->_authenticationCode) || [self->_authenticationCode isEqual:other->_authenticationCode])
134 ((!self->_initializationVector && !other->_initializationVector) || [self->_initializationVector isEqual:other->_initializationVector])
142 [self->_ciphertext hash]
144 [self->_authenticationCode hash]
146 [self->_initializationVector hash]
150 - (void)mergeFrom:(OTAuthenticatedCiphertext *)other
152 if (other->_ciphertext)
154 [self setCiphertext:other->_ciphertext];
156 if (other->_authenticationCode)
158 [self setAuthenticationCode:other->_authenticationCode];
160 if (other->_initializationVector)
162 [self setInitializationVector:other->_initializationVector];