mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-11-03 14:33:37 +03:00 
			
		
		
		
	Squashed commits: [7d1b42f] Encrypt token, skip some tests [17b8f39] Fix sha1 example path [f3050b1] Fix build, add webhook [fd2c9bd] Fix build errors, update mDNS library readme [7b87031] Make common.sh more flexible [3ba3eb2] Test all sketches [87beb8a] Build all sketches in esp8266 core [f2464f1] Fix paths [823a9ae] Remove sudo usage [7fce734] Fix arduino commands [619bc7d] Move all commands into travis script [15a5ada] First attempt test runner
		
			
				
	
	
		
			33 lines
		
	
	
		
			563 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			563 B
		
	
	
	
		
			C++
		
	
	
	
	
	
/**
 | 
						|
 * simple demo to show sha1 calculation
 | 
						|
 */
 | 
						|
#include <Arduino.h>
 | 
						|
#include <Hash.h>
 | 
						|
 | 
						|
void setup() {
 | 
						|
    Serial.begin(921600);
 | 
						|
}
 | 
						|
 | 
						|
void loop() {
 | 
						|
 | 
						|
    // usage as String
 | 
						|
    // SHA1:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
 | 
						|
 | 
						|
    Serial.print("SHA1:");
 | 
						|
    Serial.println(sha1("abc"));
 | 
						|
 | 
						|
    // usage as ptr
 | 
						|
    // SHA1:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
 | 
						|
    uint8_t hash[20];
 | 
						|
    sha1("abc", &hash[0]);
 | 
						|
 | 
						|
    Serial.print("SHA1:");
 | 
						|
    for(uint16_t i = 0; i < 20; i++) {
 | 
						|
        Serial.printf("%02x", hash[i]);
 | 
						|
    }
 | 
						|
    Serial.println();
 | 
						|
 | 
						|
    delay(1000);
 | 
						|
}
 | 
						|
 |