void SapphireHash::Final(byte *hash, unsigned int overrideHashLength) { for (int i=255; i>=0; i--) ProcessByte((byte) i); for (unsigned int j=0; j<overrideHashLength; j++) hash[j] = ProcessByte(0); }
void SapphireHash::TruncatedFinal(byte *hash, unsigned int size) { ThrowIfInvalidTruncatedSize(size); for (int i=255; i>=0; i--) ProcessByte((byte) i); for (unsigned int j=0; j<size; j++) hash[j] = ProcessByte(0); Init(); }
__interrupt void USCI0RX_ISR(void) { unsigned char data = UCA0RXBUF; if (nNewPacket == 0) { ProcessByte(data); } }
void StreamCipher::ProcessString(byte *inoutString, unsigned int length) { while(length--) *inoutString++ = ProcessByte(*inoutString); }
static void InputHandler(Widget W, int *Fd, XtInputId *Id) { int i; int BytesRead; static char *ReadBuffer = NULL; static int BufferSize = 0; #ifdef DEBUG printf("InputHandler(%s)\n", XtName(W)); #endif if (ReadBuffer == NULL) { BufferSize = 1; ReadBuffer = XtMalloc(BufferSize); } if (XtAppPending(XtWidgetToApplicationContext(W)) & XtIMAlternateInput) { fd_set rfds; struct timeval tv; FD_ZERO(&rfds); FD_SET(*Fd, &rfds); tv.tv_sec = 0; tv.tv_usec = 0; if (select(*Fd + 1, SELECT_TYPE_ARG234(&rfds), NULL, NULL, &tv)) { BytesRead = read(*Fd, ReadBuffer, BufferSize); if (BytesRead == BufferSize) { BufferSize++; ReadBuffer = XtRealloc(ReadBuffer, BufferSize); } switch (BytesRead) { case 0: fprintf(stderr, "InputHandler(%s) - EOF while reading device\n", XtName(W)); switch (Host_Type(W)) { case XltHOST_CLIENT: Disconnect(W); break; case XltHOST_SERVER: ReleaseClient(W, *Fd); break; default: break; } break; case -1: perror("InputHandler"); Disconnect(W); break; default: if (Host_InputCallback(W)) { _XltHostCallbackStruct tmp; tmp.reason = XltCR_INPUT; tmp.len = BytesRead; tmp.data = XtMalloc(tmp.len); memcpy(tmp.data, ReadBuffer, tmp.len); tmp.input_size = Host_InputSize(W); tmp.input_need = Host_InputNeed(W); XtCallCallbackList(W, Host_InputCallback(W), &tmp); if (tmp.len > BufferSize) { ReadBuffer = XtRealloc(ReadBuffer, tmp.len); BufferSize = tmp.len; } memcpy(ReadBuffer, tmp.data, tmp.len); BytesRead = tmp.len; XtFree(tmp.data); } for (i = 0; i < BytesRead; i++) { ProcessByte(W, ReadBuffer[i]); } break; } while (XtAppPending(XtWidgetToApplicationContext(W)) & ~XtIMAlternateInput) { XtAppProcessEvent(XtWidgetToApplicationContext(W), ~XtIMAlternateInput); } } } }