aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-03-15 13:54:14 +0000
committerlloyd <[email protected]>2013-03-15 13:54:14 +0000
commit8f79bb2f6d06912bafd22f686576ce0898bb1eb4 (patch)
tree2b7e9f6ed1012b2f2b346163b479971ff2fdffb2 /src/utils
parente7f15cc03003afe287d8e1e053f8fe429b34a869 (diff)
Move std::vector operator^= to xor_buf
Some prep work for parallel encrypt
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/xor_buf.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/xor_buf.h b/src/utils/xor_buf.h
index b67d84c50..5773a619c 100644
--- a/src/utils/xor_buf.h
+++ b/src/utils/xor_buf.h
@@ -96,6 +96,18 @@ void xor_buf(std::vector<byte, Alloc>& out,
xor_buf(&out[0], &in[0], &in2[0], n);
}
+template<typename T, typename Alloc, typename Alloc2>
+std::vector<T, Alloc>&
+operator^=(std::vector<T, Alloc>& out,
+ const std::vector<T, Alloc2>& in)
+ {
+ if(out.size() < in.size())
+ out.resize(in.size());
+
+ xor_buf(&out[0], &in[0], in.size());
+ return out;
+ }
+
}
#endif